RinexClockBase.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 // This software was developed by Applied Research Laboratories at the
28 // University of Texas at Austin, under contract to an agency or agencies
29 // within the U.S. Department of Defense. The U.S. Government retains all
30 // rights to use, duplicate, distribute, disclose, or release this software.
31 //
32 // Pursuant to DoD Directive 523024
33 //
34 // DISTRIBUTION STATEMENT A: This software has been approved for public
35 // release, distribution is unlimited.
36 //
37 //==============================================================================
38 
39 #include "RinexClockBase.hpp"
40 
41 using namespace std;
42 
43 namespace gnsstk
44 {
45  const RinexClockBase::RinexClkType
46  RinexClockBase::UN("UN", "Unknown or Invalid");
47  const RinexClockBase::RinexClkType
48  RinexClockBase::AR("AR", "analysis data for receiver clocks");
49  const RinexClockBase::RinexClkType
50  RinexClockBase::AS("AS", "analysis data for satellite clocks");
51  const RinexClockBase::RinexClkType
52  RinexClockBase::CR("CR", "calibration data");
53  const RinexClockBase::RinexClkType
54  RinexClockBase::DR("DR", "discontinuity data");
55  const RinexClockBase::RinexClkType
56  RinexClockBase::MS("MS", "monitor data");
57 
58 
59  string RinexClockBase::writeTime(const CivilTime& dt) const
60  {
62  {
63  return std::string(26, ' ');
64  }
65 
66  std::string line;
68  StringUtils::asString<short>(dt.year), 4);
70  StringUtils::asString<short>(dt.month), 3);
72  StringUtils::asString<short>(dt.day), 3);
74  StringUtils::asString<short>(dt.hour), 3);
76  StringUtils::asString<short>(dt.minute), 3);
78  StringUtils::asString(dt.second, 6), 10);
79 
80  return line;
81  } // writeTime
82 
83 
84  CivilTime RinexClockBase::parseTime(const string& line) const
85  {
86  if ( line.size() != 26 )
87  {
88  FFStreamError e("Invalid time string length: " +
89  StringUtils::asString(line.size()));
90  GNSSTK_THROW(e);
91  }
92 
93  if ( line == std::string(26, ' ') )
94  {
96  }
97 
98  int year, month, day, hour, min;
99  double sec;
100 
101  year = StringUtils::asInt( line.substr(0, 4) );
102  month = StringUtils::asInt( line.substr(4, 3) );
103  day = StringUtils::asInt( line.substr(7, 3) );
104  hour = StringUtils::asInt( line.substr(10, 3) );
105  min = StringUtils::asInt( line.substr(13, 3) );
106  sec = StringUtils::asDouble( line.substr(16, 10) );
107 
108  return CivilTime(year, month, day, hour, min, sec);
109 
110  } // parseTime
111 
112 
113 } // namespace
114 
gnsstk::StringUtils::asInt
long asInt(const std::string &s)
Definition: StringUtils.hpp:713
example6.day
day
Definition: example6.py:66
gnsstk::CivilTime::year
int year
Definition: CivilTime.hpp:198
gnsstk::BEGINNING_OF_TIME
const Epoch BEGINNING_OF_TIME(CommonTime::BEGINNING_OF_TIME)
Earliest representable Epoch.
example6.year
year
Definition: example6.py:64
example6.hour
hour
Definition: example6.py:67
gnsstk::StringUtils::asString
std::string asString(IonexStoreStrategy e)
Convert a IonexStoreStrategy to a whitespace-free string name.
Definition: IonexStoreStrategy.cpp:46
gnsstk::CivilTime::day
int day
Definition: CivilTime.hpp:200
RinexClockBase.hpp
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::min
T min(const SparseMatrix< T > &SM)
Maximum element - return 0 if empty.
Definition: SparseMatrix.hpp:858
gnsstk::StringUtils::asDouble
double asDouble(const std::string &s)
Definition: StringUtils.hpp:705
gnsstk::CivilTime::minute
int minute
Definition: CivilTime.hpp:202
gnsstk::CivilTime
Definition: CivilTime.hpp:55
gnsstk::StringUtils::rightJustify
std::string & rightJustify(std::string &s, const std::string::size_type length, const char pad=' ')
Definition: StringUtils.hpp:1557
std
Definition: Angle.hpp:142
gnsstk::CivilTime::month
int month
Definition: CivilTime.hpp:199
gnsstk::CivilTime::second
double second
Definition: CivilTime.hpp:203
GNSSTK_THROW
#define GNSSTK_THROW(exc)
Definition: Exception.hpp:366
example6.month
month
Definition: example6.py:65
gnsstk::CivilTime::hour
int hour
Definition: CivilTime.hpp:201


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