RinexTimeOffset.cpp
Go to the documentation of this file.
1 //==============================================================================
2 //
3 // This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
4 //
5 // The GNSSTk is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published
7 // by the Free Software Foundation; either version 3.0 of the License, or
8 // any later version.
9 //
10 // The GNSSTk is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with GNSSTk; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 //
19 // This software was developed by Applied Research Laboratories at the
20 // University of Texas at Austin.
21 // Copyright 2004-2022, The Board of Regents of The University of Texas System
22 //
23 //==============================================================================
24 
25 
26 //==============================================================================
27 //
28 // This software was developed by Applied Research Laboratories at the
29 // University of Texas at Austin, under contract to an agency or agencies
30 // within the U.S. Department of Defense. The U.S. Government retains all
31 // rights to use, duplicate, distribute, disclose, or release this software.
32 //
33 // Pursuant to DoD Directive 523024
34 //
35 // DISTRIBUTION STATEMENT A: This software has been approved for public
36 // release, distribution is unlimited.
37 //
38 //==============================================================================
39 
40 #include "RinexTimeOffset.hpp"
41 #include "TimeString.hpp"
42 
43 using namespace std;
44 
45 namespace gnsstk
46 {
47  RinexTimeOffset ::
48  RinexTimeOffset()
49  : deltatLS(0)
50  {
51  }
52 
53 
55  RinexTimeOffset(const TimeSystemCorrection& right, double leapSec)
56  : TimeSystemCorrection(right), deltatLS(leapSec)
57  {
58  }
59 
60 
62  validate() const
63  {
65  return true;
66  }
67 
68 
70  getUserTime() const
71  {
74  }
75 
76 
78  dump(ostream& s, DumpDetail dl) const
79  {
80  const ios::fmtflags oldFlags = s.flags();
81  switch (dl)
82  {
84  NavData::dump(s,dl);
85  break;
86  case DumpDetail::Brief:
87  NavData::dump(s,dl);
88  // brief just shows the offset as of the reference time.
89  s << StringUtils::asString(frTS) << "-"
90  << StringUtils::asString(toTS) << " offset = " << (deltatLS+A0)
91  << endl;
92  break;
93  case DumpDetail::Full:
94  s << "*************************************************************"
95  << "***************" << endl
96  << "Time System Offset" << endl << endl
97  << " TIMES OF INTEREST" << endl << endl
98  << " " << getDumpTimeHdr(dl) << endl
99  << "Transmit: " << getDumpTime(dl, timeStamp)
100  << endl << endl
101  << " " << StringUtils::asString(frTS) << " "
102  << StringUtils::asString(toTS) << " PARAMETERS" << endl
103  << "Parameter Value" << endl
104  << "Reference "
105  << printTime(refTime,"%Y/%02m/%02d %02H:%02M:%02S") << endl
106  << scientific << setprecision(9) << setfill(' ')
107  << "A0 " << setw(16) << A0 << " sec" << endl
108  << "A1 " << setw(16) << A1 << " sec/sec" << endl
109  << fixed << setprecision(0)
110  << "dtLS " << setw(16) << deltatLS << " sec" << endl
111  << "Provider " << setw(16) << geoProvider << endl
112  << "UTC " << setw(16);
113  switch (geoUTCid)
114  {
115  case 0: s << "Unknown" << endl; break;
116  case 1: s << "NIST" << endl; break;
117  case 2: s << "USNO" << endl; break;
118  case 3: s << "SU" << endl; break;
119  case 4: s << "BIPM" << endl; break;
120  case 5: s << "Europe" << endl; break;
121  case 6: s << "CRL" << endl; break;
122  default: s << geoUTCid << "=???" << endl; break;
123  }
124  break;
125  }
126  s.flags(oldFlags);
127  }
128 
129 
130  bool RinexTimeOffset ::
132  const CommonTime& when, double& offset)
133  const
134  {
135  try
136  {
137  // TimeSystemCorrection::Correction assumes the source
138  // time system is defined in the refTime value and the
139  // target is defined in "when".
140  offset = deltatLS + Correction(when);
141  return true;
142  }
143  catch (gnsstk::Exception& exc)
144  {
145  cerr << exc << endl;
146  return false;
147  }
148  }
149 
150 
153  {
154  TimeCvtKey keyF(frTS,toTS);
155  TimeCvtKey keyR(toTS,frTS);
156  return TimeCvtSet({ keyF, keyR });
157  }
158 
159 } // namespace gnsstk
gnsstk::NavData::getUserTime
virtual CommonTime getUserTime() const
Definition: NavData.hpp:110
gnsstk::TimeSystemCorrection
Definition: TimeSystemCorr.hpp:60
gnsstk::NavData::dump
virtual void dump(std::ostream &s, DumpDetail dl) const
Definition: NavData.cpp:79
gnsstk::TimeSystemCorrection::A1
double A1
Definition: TimeSystemCorr.hpp:166
gnsstk::TimeCvtKey
std::pair< TimeSystem, TimeSystem > TimeCvtKey
Definition: TimeOffsetData.hpp:53
gnsstk::TimeSystemCorrection::refTime
CommonTime refTime
reference time for polynominal
Definition: TimeSystemCorr.hpp:167
gnsstk::NavData::getDumpTime
std::string getDumpTime(DumpDetail dl, const CommonTime &t) const
Definition: NavData.cpp:145
gnsstk::TimeSystemCorrection::A0
double A0
Definition: TimeSystemCorr.hpp:166
gnsstk::StringUtils::asString
std::string asString(IonexStoreStrategy e)
Convert a IonexStoreStrategy to a whitespace-free string name.
Definition: IonexStoreStrategy.cpp:46
gnsstk::NavData::getDumpTimeHdr
std::string getDumpTimeHdr(DumpDetail dl) const
Definition: NavData.cpp:127
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::RinexTimeOffset::validate
bool validate() const override
Definition: RinexTimeOffset.cpp:62
gnsstk::TimeCvtSet
std::set< TimeCvtKey > TimeCvtSet
Define a unique set of time system conversions.
Definition: TimeOffsetData.hpp:55
gnsstk::NavData::timeStamp
CommonTime timeStamp
Definition: NavData.hpp:173
gnsstk::Exception
Definition: Exception.hpp:151
gnsstk::TimeSystemCorrection::geoUTCid
int geoUTCid
Definition: TimeSystemCorr.hpp:169
RinexTimeOffset.hpp
gnsstk::RinexTimeOffset::deltatLS
double deltatLS
Current or past leap second count (UTC only)
Definition: RinexTimeOffset.hpp:113
gnsstk::CommonTime
Definition: CommonTime.hpp:84
gnsstk::TimeSystemCorrection::toTS
TimeSystem toTS
Definition: TimeSystemCorr.hpp:165
gnsstk::TimeSystem
TimeSystem
Definition of various time systems.
Definition: TimeSystem.hpp:51
gnsstk::DumpDetail::Full
@ Full
Include all detailed information.
gnsstk::RinexTimeOffset::RinexTimeOffset
RinexTimeOffset()
Initialize all data to 0.
Definition: RinexTimeOffset.cpp:48
gnsstk::RinexTimeOffset::getOffset
bool getOffset(TimeSystem fromSys, TimeSystem toSys, const CommonTime &when, double &offset) const override
Definition: RinexTimeOffset.cpp:131
gnsstk::RinexTimeOffset::dump
void dump(std::ostream &s, DumpDetail dl) const override
Definition: RinexTimeOffset.cpp:78
gnsstk::DumpDetail
DumpDetail
Specify level of detail for dump output.
Definition: DumpDetail.hpp:51
gnsstk::printTime
std::string printTime(const CommonTime &t, const std::string &fmt)
Definition: TimeString.cpp:64
gnsstk::DumpDetail::Brief
@ Brief
Limit output to <= 5 lines of minimal information.
std
Definition: Angle.hpp:142
gnsstk::TimeSystemCorrection::Correction
double Correction(const CommonTime &ct) const
Definition: TimeSystemCorr.cpp:388
gnsstk::DumpDetail::OneLine
@ OneLine
Limit output to minimal information on a single line.
gnsstk::TimeSystemCorrection::frTS
TimeSystem frTS
Definition: TimeSystemCorr.hpp:165
gnsstk::TimeSystemCorrection::geoProvider
std::string geoProvider
string 'EGNOS' 'WAAS' or 'MSAS'
Definition: TimeSystemCorr.hpp:168
gnsstk::RinexTimeOffset::getUserTime
CommonTime getUserTime() const override
Definition: RinexTimeOffset.cpp:70
gnsstk::RinexTimeOffset::getConversions
TimeCvtSet getConversions() const override
Definition: RinexTimeOffset.cpp:152
TimeString.hpp


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:41