Public Member Functions | List of all members
gnsstk::Epoch Class Reference

Detailed Description

Todo:
Fix these comments.

A time representation class for all common time formats, including GPS. There is a seamless conversion between dates, times, and both, as well as the ability to input and output the stored day-time in formatted strings (printf() and scanf()).

Internally, the representation of day and time uses a CommonTime object.

See also
CommonTime

In addition, the representation includes a tolerance value which is used in CommonTime comparisons. It defaults to the value of the static gnsstk::Epoch::EPOCH_TOLERANCE, but this can be modified with the static method setEpochTolerance(). Several different default tolerances have been defined and are in the Epoch-Specific Definitions section. The tolerance can also be changed on a per-object basis with the setTolerance() member function. All comparisons are done using the tolerance as a range for the comparison. So, for example, operator==() returns true if the times are within 'tolerance' seconds. Once set for each object, the tolerance is appropriately "carried forward" to new objects through the copy operator (operator=), the copy constructor, and elsewhere.

The internal representation is manipulated using four fundamental routines, two that convert between 'jday' (the integer representation of JD) and calendar date: year/month/day-of-month, and two that convert between seconds-of-day and hour/minute/second. These routines can be found in the TimeConverters.hpp file. The range of validity of the jday–calendar routines is approximately 4317 B.C. to 4317 A.D.; these limits are incorporated into constants Epoch::BEGINNING_OF_TIME and Epoch::END_OF_TIME.

This representation separates day and time-of-day cleanly. Because day and time are logically separated, it is possible to use Epoch for day only, or for time only. Thus, for example, one could instantiate a Epoch object and only manipulate the date, without reference to time-of-day; or vice-versa. [However in this regard note that the default constructor for Epoch sets the data, not to zero, but to the current (system) time.]

When constructing Epoch objects from GPS time values – such as GPS week and seconds of weeks, or GPS week and z count – there may be ambiguity associated with the GPS week. Many receivers and receiver processing software store the GPS week as it appears in the NAV message, as a 10-bit number. This leads to a 1024 week ambiguity when 10-bit GPS weeks are used to specify a Epoch. In general, Epoch uses the system time to disambiguate which 1024 week period to use. This is a good assumption except when processing binary data from before GPS week rollover, which occured on August 22, 1999.

Definition at line 123 of file Epoch.hpp.

#include <Epoch.hpp>

Public Member Functions

 NEW_EXCEPTION_CLASS (EpochException, gnsstk::Exception)
 
 NEW_EXCEPTION_CLASS (FormatException, gnsstk::Exception)
 
Constructors and Destructor
 Epoch (const TimeTag &tt=SystemTime())
 
 Epoch (const CommonTime &ct) noexcept
 
 Epoch (const WeekSecond &tt, short year)
 
 Epoch (const GPSZcount &gzc) noexcept
 
 ~Epoch () noexcept
 Destructor. More...
 
Assignment and Copy
 Epoch (const Epoch &right) noexcept
 Copy constructor. More...
 
Epochoperator= (const Epoch &right) noexcept
 Assignment operator. More...
 
Arithmetic
double operator- (const Epoch &right) const noexcept
 
Epoch operator+ (double sec) const
 
Epoch operator- (double sec) const
 
Epochoperator+= (double sec)
 
Epochoperator-= (double sec)
 
EpochaddSeconds (double seconds)
 
EpochaddSeconds (long seconds)
 
EpochaddMilliSeconds (long msec)
 
EpochaddMicroSeconds (long usec)
 
Comparisons
bool operator== (const Epoch &right) const noexcept
 
bool operator!= (const Epoch &right) const noexcept
 
bool operator< (const Epoch &right) const noexcept
 
bool operator> (const Epoch &right) const noexcept
 
bool operator<= (const Epoch &right) const noexcept
 
bool operator>= (const Epoch &right) const noexcept
 
Accessor Methods (get and set)
template<class TimeTagType >
TimeTagType get () const
 
long double JD () const
 
long double MJD () const
 
short year () const
 Get year. More...
 
short month () const
 Get month of year. More...
 
short day () const
 Get day of month. More...
 
short dow () const
 Get day of week. More...
 
short hour () const
 Get hour of day. More...
 
short minute () const
 Get minutes of hour. More...
 
double second () const
 Get seconds of minute. More...
 
double sod () const
 Get seconds of day. More...
 
short GPSModWeek () const
 Get 10-bit GPS week. More...
 
short GPSweek10 () const
 Get 10-bit GPS week. Deprecated, used GPSModWeek() More...
 
long GPSzcount () const
 Get normal (19 bit) zcount. More...
 
long GPSzcountFloor () const
 Same as GPSzcount() but without rounding to nearest zcount. More...
 
unsigned long GPSzcount32 () const
 
unsigned long GPSzcount32Floor () const
 Same as fullZcount() but without rounding to nearest zcount. More...
 
double GPSsow () const
 Get GPS second of week. More...
 
short GPSweek () const
 Get full (>10 bits) week. More...
 
double BDSsow () const
 Get BDS second of week. More...
 
short BDSweek () const
 Get full BDS week. More...
 
short BDSModWeek () const
 Get mod (short) BDS week. More...
 
double QZSsow () const
 Get QZS second of week. More...
 
short QZSweek () const
 Get full QZS week. More...
 
short QZSModWeek () const
 Get mod (short) QZS week. More...
 
double GALsow () const
 Get GAL second of week. More...
 
short GALweek () const
 Get full GAL week. More...
 
short GALModWeek () const
 Get mod (short) GAL week. More...
 
short doy () const
 Get day of year. More...
 
struct timeval unixTime () const
 Get object time in UNIX timeval structure. More...
 
 operator GPSZcount () const
 
 operator CommonTime () const noexcept
 Convert this object to a CommonTime object. More...
 
Epochset (const TimeTag &tt=SystemTime())
 
Epochset (const WeekSecond &tt, short year)
 
Epochset (const CommonTime &c) noexcept
 
Epochset (const GPSZcount &z)
 
EpochsetTime (const CommonTime &ct)
 
EpochsetDate (const CommonTime &ct)
 
EpochsetLocalTime ()
 
Printing and Scanning Methods
Epochscanf (const std::string &str, const std::string &fmt)
 
std::string printf (const std::string &fmt=PRINT_FORMAT) const
 

Static Public Attributes

Epoch-Specific Definitions

All of these tolerances are 1/2 of the tolerance they specify. So one nsec tolerance is actually 1/2 an ns added to the time in units of days.

static const double ONE_NSEC_TOLERANCE = 1e-9
 One nanosecond tolerance. More...
 
static const double ONE_USEC_TOLERANCE = 1e-6
 One microsecond tolerance. More...
 
static const double ONE_MSEC_TOLERANCE = 1e-3
 One millisecond tolerance. More...
 
static const double ONE_SEC_TOLERANCE = 1
 One second tolerance. More...
 
static const double ONE_MIN_TOLERANCE = 60
 One minute tolerance. More...
 
static const double ONE_HOUR_TOLERANCE = 3600
 One hour tolerance. More...
 
static double EPOCH_TOLERANCE = ONE_NSEC_TOLERANCE
 Default tolerance for time equality in days. More...
 
static const Epoch BEGINNING_OF_TIME
 Earliest representable Epoch. More...
 
static const Epoch END_OF_TIME
 Latest Representable Epoch. More...
 
static std::string PRINT_FORMAT
 This is how an Epoch is printed by default. More...
 

Private Attributes

Private Methods and Data Members
CommonTime core
 
double tolerance
 double tolerance used in comparisons (seconds) More...
 

Tolerance Functions

EpochsetTolerance (double tol) noexcept
 
double getTolerance () const noexcept
 
static double setEpochTolerance (double tol) noexcept
 Changes the EPOCH_TOLERANCE for all Epoch objects. More...
 
static double getEpochTolerance () noexcept
 Returns the current EPOCH_TOLERANCE. More...
 

Constructor & Destructor Documentation

◆ Epoch() [1/5]

gnsstk::Epoch::Epoch ( const TimeTag tt = SystemTime())

Default Constructor. Initializes to current system time or to the given TimeTag. TimeTag-covered constructors: year, month, day, hour, minute, second (CivilTime) long double mjd (MJD) double mjd (MJD) year, doy, sod (YDSTime) Unix struct timeval (UnixTime) GPS full week and second (GPSWeekSecond)

Exceptions
EpochException

Definition at line 93 of file Epoch.cpp.

◆ Epoch() [2/5]

gnsstk::Epoch::Epoch ( const CommonTime ct)
noexcept

CommonTime Constructor. Set the time using the given CommonTime object.

Definition at line 98 of file Epoch.cpp.

◆ Epoch() [3/5]

gnsstk::Epoch::Epoch ( const WeekSecond tt,
short  year 
)

TimeTag + Year Constructor. Set the current time using the given year as a hint. For example, when one only knows the 10-bit GPS week, one could could use a "hint" year to figure out which Epoch the week was in. TimeTag + year -covered constructors: gps 10-bit week and second and year (GPSEpochWeekSecond + year) gps week and zcount and year (GPSWeekZcount + year)

Exceptions
EpochexceptionTimeTag + Year Constructor. Set the current time using the given year as a hint.

Definition at line 107 of file Epoch.cpp.

◆ Epoch() [4/5]

gnsstk::Epoch::Epoch ( const GPSZcount gzc)
noexcept

GPSZcount Constructor. Set the current time using the given GPSZcount.

Definition at line 117 of file Epoch.cpp.

◆ ~Epoch()

gnsstk::Epoch::~Epoch ( )
inlinenoexcept

Destructor.

Definition at line 249 of file Epoch.hpp.

◆ Epoch() [5/5]

gnsstk::Epoch::Epoch ( const Epoch right)
noexcept

Copy constructor.

Definition at line 141 of file Epoch.cpp.

Member Function Documentation

◆ addMicroSeconds()

Epoch & gnsstk::Epoch::addMicroSeconds ( long  usec)

Add (integer) microseconds to this time.

Parameters
usecNumber of microseconds to increase this time by.
Exceptions
EpochExceptionon over/under-flow

Definition at line 245 of file Epoch.cpp.

◆ addMilliSeconds()

Epoch & gnsstk::Epoch::addMilliSeconds ( long  msec)

Add (integer) milliseconds to this time.

Parameters
msecNumber of milliseconds to increase this time by.
Exceptions
EpochExceptionon over/under-flow

Definition at line 229 of file Epoch.cpp.

◆ addSeconds() [1/2]

Epoch & gnsstk::Epoch::addSeconds ( double  seconds)

Add (double) seconds to this time.

Parameters
secondsNumber of seconds to increase this time by.
Exceptions
EpochExceptionon over/under-flow

Definition at line 197 of file Epoch.cpp.

◆ addSeconds() [2/2]

Epoch & gnsstk::Epoch::addSeconds ( long  seconds)

Add (integer) seconds to this time.

Parameters
secondsNumber of seconds to increase this time by.
Exceptions
EpochExceptionon over/under-flow

Definition at line 213 of file Epoch.cpp.

◆ BDSModWeek()

short gnsstk::Epoch::BDSModWeek ( ) const
inline

Get mod (short) BDS week.

Get mod (short) BDS week

Exceptions
EpochException

Definition at line 858 of file Epoch.hpp.

◆ BDSsow()

double gnsstk::Epoch::BDSsow ( ) const
inline

Get BDS second of week.

Get BDS second of week.

Exceptions
EpochException

Definition at line 846 of file Epoch.hpp.

◆ BDSweek()

short gnsstk::Epoch::BDSweek ( ) const
inline

Get full BDS week.

Get full BDS week

Exceptions
EpochException

Definition at line 852 of file Epoch.hpp.

◆ day()

short gnsstk::Epoch::day ( ) const
inline

Get day of month.

Get day of month.

Exceptions
EpochException

Definition at line 758 of file Epoch.hpp.

◆ dow()

short gnsstk::Epoch::dow ( ) const
inline

Get day of week.

Get day of week

Exceptions
EpochException

Definition at line 764 of file Epoch.hpp.

◆ doy()

short gnsstk::Epoch::doy ( ) const
inline

Get day of year.

Get day of year.

Exceptions
EpochException

Definition at line 900 of file Epoch.hpp.

◆ GALModWeek()

short gnsstk::Epoch::GALModWeek ( ) const
inline

Get mod (short) GAL week.

Get mod (short) GAL week

Exceptions
EpochException

Definition at line 894 of file Epoch.hpp.

◆ GALsow()

double gnsstk::Epoch::GALsow ( ) const
inline

Get GAL second of week.

Get GAL second of week.

Exceptions
EpochException

Definition at line 882 of file Epoch.hpp.

◆ GALweek()

short gnsstk::Epoch::GALweek ( ) const
inline

Get full GAL week.

Get full GAL week

Exceptions
EpochException

Definition at line 888 of file Epoch.hpp.

◆ get()

template<class TimeTagType >
TimeTagType gnsstk::Epoch::get

Get the specified TimeTag. This function converts the internal store into the requested TimeTag type.

Exceptions
EpochException

Definition at line 719 of file Epoch.hpp.

◆ getEpochTolerance()

static double gnsstk::Epoch::getEpochTolerance ( )
inlinestaticnoexcept

Returns the current EPOCH_TOLERANCE.

Definition at line 180 of file Epoch.hpp.

◆ getTolerance()

double gnsstk::Epoch::getTolerance ( ) const
inlinenoexcept

Return the tolerance value currently in use by this object.

Returns
the current tolerance value (in seconds, of course)

Definition at line 198 of file Epoch.hpp.

◆ GPSModWeek()

short gnsstk::Epoch::GPSModWeek ( ) const
inline

Get 10-bit GPS week.

Get 10-bit GPS week

Exceptions
EpochException

Definition at line 800 of file Epoch.hpp.

◆ GPSsow()

double gnsstk::Epoch::GPSsow ( ) const
inline

Get GPS second of week.

Get GPS second of week.

Exceptions
EpochException

Definition at line 834 of file Epoch.hpp.

◆ GPSweek()

short gnsstk::Epoch::GPSweek ( ) const
inline

Get full (>10 bits) week.

Get full (>10 bits) week

Exceptions
EpochException

Definition at line 840 of file Epoch.hpp.

◆ GPSweek10()

short gnsstk::Epoch::GPSweek10 ( ) const
inline

Get 10-bit GPS week. Deprecated, used GPSModWeek()

Get 10-bit GPS week, deprecated, use GPSModWeek()

Exceptions
EpochException

Definition at line 794 of file Epoch.hpp.

◆ GPSzcount()

long gnsstk::Epoch::GPSzcount ( ) const
inline

Get normal (19 bit) zcount.

Get normal (19 bit) zcount.

Exceptions
EpochException

Definition at line 806 of file Epoch.hpp.

◆ GPSzcount32()

unsigned long gnsstk::Epoch::GPSzcount32 ( ) const
inline

Get time as 32 bit Z count. The 13 MSBs are week modulo 1024, 19 LSBs are seconds of week in Zcounts.

Exceptions
EpochExceptionGet time as 32 bit Z count. The 13 MSBs are week modulo 1024, 19 LSBs are seconds of week in Zcounts.

Definition at line 821 of file Epoch.hpp.

◆ GPSzcount32Floor()

unsigned long gnsstk::Epoch::GPSzcount32Floor ( ) const
inline

Same as fullZcount() but without rounding to nearest zcount.

Same as fullZcount() but without rounding to nearest zcount.

Exceptions
EpochException

Definition at line 827 of file Epoch.hpp.

◆ GPSzcountFloor()

long gnsstk::Epoch::GPSzcountFloor ( ) const
inline

Same as GPSzcount() but without rounding to nearest zcount.

Same as GPSzcount() but without rounding to nearest zcount.

Exceptions
EpochException

Definition at line 812 of file Epoch.hpp.

◆ hour()

short gnsstk::Epoch::hour ( ) const
inline

Get hour of day.

Get hour of day.

Exceptions
EpochException

Definition at line 770 of file Epoch.hpp.

◆ JD()

long double gnsstk::Epoch::JD ( ) const
inline

Get Julian Date JD

Warning
For some compilers, this result may have diminished accuracy.
Exceptions
EpochException

Get Julian Date JD

Warning
For some compilers, this result may have diminished accuracy.

Definition at line 732 of file Epoch.hpp.

◆ minute()

short gnsstk::Epoch::minute ( ) const
inline

Get minutes of hour.

Get minutes of hour.

Exceptions
EpochException

Definition at line 776 of file Epoch.hpp.

◆ MJD()

long double gnsstk::Epoch::MJD ( ) const
inline

Get Modified Julian Date MJD

Warning
For some compilers, this result may have diminished accuracy.
Exceptions
EpochException

Get Modified Julian Date MJD

Warning
For some compilers, this result may have diminished accuracy.

Definition at line 740 of file Epoch.hpp.

◆ month()

short gnsstk::Epoch::month ( ) const
inline

Get month of year.

Get month of year.

Exceptions
EpochException

Definition at line 752 of file Epoch.hpp.

◆ NEW_EXCEPTION_CLASS() [1/2]

gnsstk::Epoch::NEW_EXCEPTION_CLASS ( EpochException  ,
gnsstk::Exception   
)

Epoch basic exception class.

Todo:
Do we need this, or can we get by with InvaildRequest and/or InvalidParameter?

◆ NEW_EXCEPTION_CLASS() [2/2]

gnsstk::Epoch::NEW_EXCEPTION_CLASS ( FormatException  ,
gnsstk::Exception   
)

Epoch formatting ("printing") error exception class.

◆ operator CommonTime()

gnsstk::Epoch::operator CommonTime ( ) const
noexcept

Convert this object to a CommonTime object.

Definition at line 309 of file Epoch.cpp.

◆ operator GPSZcount()

gnsstk::Epoch::operator GPSZcount ( ) const

Convert this object to a GPSZcount object.

Exceptions
EpochException

Definition at line 124 of file Epoch.cpp.

◆ operator!=()

bool gnsstk::Epoch::operator!= ( const Epoch right) const
noexcept

Definition at line 273 of file Epoch.cpp.

◆ operator+()

Epoch gnsstk::Epoch::operator+ ( double  sec) const

Add seconds to this time.

Parameters
secNumber of seconds to increase this time by.
Returns
The new time incremented by sec.
Exceptions
EpochException

Definition at line 168 of file Epoch.cpp.

◆ operator+=()

Epoch & gnsstk::Epoch::operator+= ( double  sec)

Add seconds to this time.

Parameters
secNumber of seconds to increase this time by.
Exceptions
EpochExceptionon over/under-flow

Definition at line 183 of file Epoch.cpp.

◆ operator-() [1/2]

double gnsstk::Epoch::operator- ( const Epoch right) const
noexcept

Epoch difference function.

Parameters
rightEpoch to subtract from this one.
Returns
difference in seconds.

Definition at line 159 of file Epoch.cpp.

◆ operator-() [2/2]

Epoch gnsstk::Epoch::operator- ( double  sec) const

Subtract seconds from this time.

Parameters
secNumber of seconds to decrease this time by.
Returns
The new time decremented by sec.
Exceptions
EpochException

Definition at line 176 of file Epoch.cpp.

◆ operator-=()

Epoch & gnsstk::Epoch::operator-= ( double  sec)

Subtract seconds from this time.

Parameters
secNumber of seconds to decrease this time by.
Exceptions
EpochExceptionon over/under-flow

Definition at line 190 of file Epoch.cpp.

◆ operator<()

bool gnsstk::Epoch::operator< ( const Epoch right) const
noexcept

Definition at line 280 of file Epoch.cpp.

◆ operator<=()

bool gnsstk::Epoch::operator<= ( const Epoch right) const
noexcept

Definition at line 296 of file Epoch.cpp.

◆ operator=()

Epoch & gnsstk::Epoch::operator= ( const Epoch right)
noexcept

Assignment operator.

Definition at line 148 of file Epoch.cpp.

◆ operator==()

bool gnsstk::Epoch::operator== ( const Epoch right) const
noexcept

Definition at line 264 of file Epoch.cpp.

◆ operator>()

bool gnsstk::Epoch::operator> ( const Epoch right) const
noexcept

Definition at line 288 of file Epoch.cpp.

◆ operator>=()

bool gnsstk::Epoch::operator>= ( const Epoch right) const
noexcept

Definition at line 303 of file Epoch.cpp.

◆ printf()

string gnsstk::Epoch::printf ( const std::string &  fmt = PRINT_FORMAT) const

Format this time into a string.

Note
Whenever a format is added or removed from the Epoch class, it more than likely should also be added or removed from the FileSpec class. Additionally, the format character must not conflict with any of the existing format characters in Epoch or FileSpec.

Generate and return a string containing a formatted date, formatted by the specification fmt.

  • %Y year()
  • %y year() % 100
  • %m month()
  • %d day()
  • %H hour()
  • %M minute()
  • %S (short)second()
  • %f second()
  • %E GPS getEpoch()
  • %G GPS getModWeek()
  • %F GPS getWeek()
  • %g GPS/BDS/GAL/QZS sow() or getSOW()
  • %Z GPSzcount()
  • %z GPSzcountFloor()
  • %R BDS getEpoch()
  • %D BDS getWeek()
  • %e BDS getModWeek()
  • %T GAL getEpoch()
  • %L GAL getWeek()
  • %l GAL getModWeek()
  • %V QZS getEpoch()
  • %I QZS getWeek()
  • %i QZS getModWeek()
  • %s DOYsecond()
  • %Q MJDdate()
  • %w dayOfWeek() or GPSday()
  • %b MonthAbbrevName[month()]
  • %B MonthName[month()]
  • %a DayOfWeekAbbrevName[dayOfWeek()]
  • %A DayOfWeekName[dayOfWeek()]
  • %j DOYday() or DOY()
  • %U unixTime().tv_sec
  • %u unixTime().tv_usec
  • %C fullZcount()
  • %c fullZcountFloor()
Warning
See above note.
Parameters
fmtformat to use for this time.
Returns
a string containing this time in the representation specified by fmt.
Exceptions
StringUtils::StringException

Definition at line 433 of file Epoch.cpp.

◆ QZSModWeek()

short gnsstk::Epoch::QZSModWeek ( ) const
inline

Get mod (short) QZS week.

Get mod (short) QZS week

Exceptions
EpochException

Definition at line 876 of file Epoch.hpp.

◆ QZSsow()

double gnsstk::Epoch::QZSsow ( ) const
inline

Get QZS second of week.

Get QZS second of week.

Exceptions
EpochException

Definition at line 864 of file Epoch.hpp.

◆ QZSweek()

short gnsstk::Epoch::QZSweek ( ) const
inline

Get full QZS week.

Get full QZS week

Exceptions
EpochException

Definition at line 870 of file Epoch.hpp.

◆ scanf()

Epoch & gnsstk::Epoch::scanf ( const std::string &  str,
const std::string &  fmt 
)
Todo:
Someone figure out how to make the table below show up nice in doxygen.

Similar to scanf, this function takes a string and a format describing string in order to read in values. The parameters it can take are listed below and described above with the printf() function.

The specification must resolve to a day at a minimum level. The following table lists combinations that give valid times. Anything more or other combinations will give unknown (read as: "bad") results so don't try it. Anything less will throw an exception. If nothing changes the time of day, it will default to midnight. Also, the year defaults to the current year if a year isn't specified or can't be determined.

1 of... and 1 of.... optional...
%C
%G %w %g %Z %Y %y %E (GPS)
%e %w %g %Y %y %R (BDS)
%l %w %g %Y %y %T (GAL)
%i %w %g %Y %y %V (QZS)
%F %w %g %Z (GPS)
%D %w %g (BDS)
%L %w %g (GAL)
%I %w %g (QZS)
%m %B %b %a %A %d %Y %y %H %M %S
%Q
%j %Y %y %s

So

time.setToString("Aug 1, 2000 20:20:20", "%b %d, %Y %H:%M:%S")

works but

time.setToString("Aug 2000", "%b %Y")

doesn't work (incomplete specification because it doesn't specify a day).

Don't worry about counting whitespace - this function will take care of that. Just make sure that the extra stuff in the format string (ie '.' ',') are in the same relative location as they are in the actual string. (see in the example above))

Parameters
strstring to get date/time from.
fmtformat to use to parse str.
Exceptions
EpochExceptionif fmt is an incomplete specification
FormatExceptionif unable to scan str.
StringExceptionif an error occurs manipulating the str or fmt strings.
Returns
a reference to this object.

Definition at line 418 of file Epoch.cpp.

◆ second()

double gnsstk::Epoch::second ( ) const
inline

Get seconds of minute.

Get seconds of minute.

Exceptions
EpochException

Definition at line 782 of file Epoch.hpp.

◆ set() [1/4]

Epoch & gnsstk::Epoch::set ( const CommonTime c)
noexcept

Set the object using the give CommonTime.

Parameters
cthe CommonTime object to set to
Returns
a reference to this object.

Definition at line 337 of file Epoch.cpp.

◆ set() [2/4]

Epoch & gnsstk::Epoch::set ( const GPSZcount z)

Set the object using a GPSZcount object.

Exceptions
EpochException

Definition at line 350 of file Epoch.cpp.

◆ set() [3/4]

Epoch & gnsstk::Epoch::set ( const TimeTag tt = SystemTime())
Todo:
Could we get away with just CommonTime sets? The TimeTags can convert themselves to CommonTime objects. That's what we do internally anyway...

Set the object using a TimeTag object.

Parameters
ttthe TimeTag to which to set this object (Defaults to SystemTime()).
Returns
a reference to this object.
Exceptions
EpochException

Definition at line 315 of file Epoch.cpp.

◆ set() [4/4]

Epoch & gnsstk::Epoch::set ( const WeekSecond tt,
short  year 
)

Set the object using a TimeTag and a year as a hint.

Parameters
ttthe TimeTag to which to set this object.
yearthe "hint" year
Returns
a reference to this object.
Exceptions
EpochException

Definition at line 329 of file Epoch.cpp.

◆ setDate()

Epoch & gnsstk::Epoch::setDate ( const CommonTime ct)

Set the object's date using a CommonTime object. This operation leaves the object's time unchanged.

Note
as TimeTags can be implicitly converted to CommonTime objects, this method works for them as well.
Exceptions
EpochException

Definition at line 385 of file Epoch.cpp.

◆ setEpochTolerance()

static double gnsstk::Epoch::setEpochTolerance ( double  tol)
inlinestaticnoexcept

Changes the EPOCH_TOLERANCE for all Epoch objects.

Definition at line 175 of file Epoch.hpp.

◆ setLocalTime()

Epoch & gnsstk::Epoch::setLocalTime ( )

Set the object time to the current local time.

Todo:
What is this?
Exceptions
EpochException

Definition at line 404 of file Epoch.cpp.

◆ setTime()

Epoch & gnsstk::Epoch::setTime ( const CommonTime ct)

Set the object's time using a CommonTime object. This operation leaves the object's date unchanged.

Note
as TimeTags can be implicitly converted to CommonTime objects, this method works for them as well.
Exceptions
EpochException

Definition at line 367 of file Epoch.cpp.

◆ setTolerance()

Epoch & gnsstk::Epoch::setTolerance ( double  tol)
noexcept

Sets the tolerance for output and comparisons on this object only. See the constants in this file (e.g. ONE_NSEC_TOLERANCE) for some easy to use tolerance values.

Parameters
tolTolerance in days to be used by comparison operators.
See also
Epoch-Specific Definitions

Definition at line 85 of file Epoch.cpp.

◆ sod()

double gnsstk::Epoch::sod ( ) const
inline

Get seconds of day.

Get seconds of day.

Exceptions
EpochException

Definition at line 788 of file Epoch.hpp.

◆ unixTime()

struct timeval gnsstk::Epoch::unixTime ( ) const
inline

Get object time in UNIX timeval structure.

Get object time in UNIX timeval structure.

Exceptions
EpochException

Definition at line 906 of file Epoch.hpp.

◆ year()

short gnsstk::Epoch::year ( ) const
inline

Get year.

Get year.

Exceptions
EpochException

Definition at line 746 of file Epoch.hpp.

Member Data Documentation

◆ BEGINNING_OF_TIME

const Epoch gnsstk::Epoch::BEGINNING_OF_TIME
static

Earliest representable Epoch.

Definition at line 164 of file Epoch.hpp.

◆ core

CommonTime gnsstk::Epoch::core
private

This is the core of the Epoch.

See also
CommonTime.hpp

Definition at line 699 of file Epoch.hpp.

◆ END_OF_TIME

const Epoch gnsstk::Epoch::END_OF_TIME
static

Latest Representable Epoch.

Definition at line 166 of file Epoch.hpp.

◆ EPOCH_TOLERANCE

double gnsstk::Epoch::EPOCH_TOLERANCE = ONE_NSEC_TOLERANCE
static

Default tolerance for time equality in days.

Definition at line 161 of file Epoch.hpp.

◆ ONE_HOUR_TOLERANCE

const double gnsstk::Epoch::ONE_HOUR_TOLERANCE = 3600
static

One hour tolerance.

Definition at line 158 of file Epoch.hpp.

◆ ONE_MIN_TOLERANCE

const double gnsstk::Epoch::ONE_MIN_TOLERANCE = 60
static

One minute tolerance.

Definition at line 156 of file Epoch.hpp.

◆ ONE_MSEC_TOLERANCE

const double gnsstk::Epoch::ONE_MSEC_TOLERANCE = 1e-3
static

One millisecond tolerance.

Definition at line 152 of file Epoch.hpp.

◆ ONE_NSEC_TOLERANCE

const double gnsstk::Epoch::ONE_NSEC_TOLERANCE = 1e-9
static

One nanosecond tolerance.

Definition at line 148 of file Epoch.hpp.

◆ ONE_SEC_TOLERANCE

const double gnsstk::Epoch::ONE_SEC_TOLERANCE = 1
static

One second tolerance.

Definition at line 154 of file Epoch.hpp.

◆ ONE_USEC_TOLERANCE

const double gnsstk::Epoch::ONE_USEC_TOLERANCE = 1e-6
static

One microsecond tolerance.

Definition at line 150 of file Epoch.hpp.

◆ PRINT_FORMAT

std::string gnsstk::Epoch::PRINT_FORMAT
static

This is how an Epoch is printed by default.

Definition at line 169 of file Epoch.hpp.

◆ tolerance

double gnsstk::Epoch::tolerance
private

double tolerance used in comparisons (seconds)

Definition at line 702 of file Epoch.hpp.


The documentation for this class was generated from the following files:
gnsstk::TrackingCode::Y
@ Y
Encrypted legacy GPS precise code.
y
page HOWTO subpage DoxygenGuide Documenting Your Code page DoxygenGuide Documenting Your Code todo Flesh out this document section doctips Tips for Documenting When defining make sure that the prototype is identical between the cpp and hpp including both the namespaces and the parameter names for you have std::string as the return type in the hpp file and string as the return type in the cpp Doxygen may get confused and autolink to the cpp version with no documentation If you don t use the same parameter names between the cpp and hpp that will also confuse Doxygen Don t put type information in return or param documentation It doesn t really add anything and will often cause Doxygen to complain and not produce the documentation< br > use note Do not put a comma after a param name unless you mean to document multiple parameters< br/> the output stream</code >< br/> y
Definition: DOCUMENTING.dox:15
example4.time
time
Definition: example4.py:103


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