/*
* \file galileo_utc_model.h
* \brief Interface of a Galileo UTC MODEL storage
* \author Javier Arribas, 2013. jarribas(at)cttc.es
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2013 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see .
*
* -------------------------------------------------------------------------
*/
#include "galileo_utc_model.h"
Galileo_Utc_Model::Galileo_Utc_Model()
{
//valid = false;
/*Word type 6: GST-UTC conversion parameters*/
A0_6 = 0;
A1_6 = 0;
Delta_tLS_6 = 0;
t0t_6 = 0;
WNot_6 = 0;
WN_LSF_6 = 0;
DN_6 = 0;
Delta_tLSF_6 = 0;
flag_utc_model = false;
}
double Galileo_Utc_Model::GST_to_UTC_time(double t_e, int WN)
{
double t_Utc;
double t_Utc_daytime;
double Delta_t_Utc=0;
// Determine if the effectivity time of the leap second event is in the past
int weeksToLeapSecondEvent = WN_LSF_6 - (WN % 256);
if ((weeksToLeapSecondEvent) >= 0) // is not in the past
{
//Detect if the effectivity time and user's time is within six hours = 6 * 60 *60 = 21600 s
int secondOfLeapSecondEvent = DN_6 * 24 * 60 * 60;
if (abs(t_e - secondOfLeapSecondEvent) > 21600)
{
/* 5.1.7a
* Whenever the leap second adjusted time indicated by the WN_LSF and the DN values
* is not in the past (relative to the user's present time), and the user's
* present time does not fall in the time span which starts at six hours prior
* to the effective time and ends at six hours after the effective time,
* the GST/Utc relationship is given by
*/
//std::cout<<"GST->UTC case a"<UTC case b"<UTC case c"<