DayTime Class Reference
[GPStk Time Group]

#include <DayTime.hpp>

Inheritance diagram for DayTime:

Inheritance graph
[legend]
Collaboration diagram for DayTime:

Collaboration graph
[legend]
List of all members.

Detailed Description

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 setToString()).

Internally, the representation of day and time uses three quantities, (1) jday, an integer representation of Julian Date, specifically jday = int(JD+0.5) or jday=int(MJD+2400001). [Recall that JD = MJD + 2400000.5 and MJD is an integer when second-of-day==0. N.B. jday is NOT == JD or Julian Date, but DayTime::JD() does return JD.] (2) mSod, the integer part of milliseconds of the day, and (3) mSec, the (double) fractional part of milliseconds of the day.

In addition, the representation includes a tolerance value (see below) and a time frame. The time frame is a simple way of denoting the origin or type of day-time which is stored in the object. See TimeFrame for the list of possible values. The time frame of an object is determined in the call to a constructor (default is timeFrame=Unknown), and carried forward into other objects. It may be read or changed using member functions setAllButTimeFrame(), setTimeFrame(), and getTimeFrame().

The member datum 'double tolerance' is used in DayTime comparisons. It defaults to the value of the static gpstk::DayTime::DAYTIME_TOLERANCE, but this can be modified with the static method setDayTimeTolerance(). Several different default tolerances have been defined and are in the DayTime-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 (DayTime::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. The range of validity of the jday--calendar routines is approximately 4317 B.C. to 4317 A.D.; these limits are incorporated into constants DayTime::BEGINNING_OF_TIME and DayTime::END_OF_TIME.

* All DayTime objects that lie outside these limits are disallowed. *

This internal representation allows close to the maximum precision possible in the time-of-day. Although, note that the code uses FACTOR=1000 everywhere to compute milliseconds, via e.g. mSec=seconds/FACTOR, and thus FACTOR could be changed to give a different precision. (This has not been tested.)

This representation separates day and time-of-day cleanly. Because day and time are logically separated, it is possible to use DayTime for day only, or for time only. Thus, for example, one could instantiate a DayTime 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 DayTime sets the data, not to zero, but to the current (system) time; because there is no year 0, a DayTime object with all zero data is invalid!]

When constructing DayTime 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 DayTime. In general, DayTime 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 154 of file DayTime.hpp.

Public Types

enum  TimeFrame {
  Unknown, UTC, LocalSystem, GPS_Tx,
  GPS_Rx, GPS_SV, GPS_Receiver
}
 The various time frames. More...

Public Member Functions

DayTimesetTolerance (const double tol) throw ()
 Sets the tolerance for output and comparisons on this object only.
double getTolerance () throw ()
 Return the tolerance value currently in use by this object.
 DayTime () throw (DayTimeException)
 Default constructor.
 DayTime (short GPSWeek, double GPSSecond, TimeFrame f=Unknown) throw (DayTimeException)
 GPS time with full week constructor.
 DayTime (short GPSWeek, double GPSSecond, short year, TimeFrame f=Unknown) throw (DayTimeException)
 GPS time constructor.
 DayTime (short GPSWeek, long zcount, short year, TimeFrame f=Unknown) throw (DayTimeException)
 GPS time constructor.
 DayTime (unsigned long fullZcount, TimeFrame f=Unknown) throw (DayTimeException)
 GPS time constructor given the full Z count.
 DayTime (const GPSZcount &z, TimeFrame f=Unknown) throw (DayTimeException)
 GPS Zcount constructor.
 DayTime (const CommonTime &c, TimeFrame f=Unknown) throw (DayTimeException)
 CommonTime constructor.
 DayTime (short year, short month, short day, short hour, short minute, double second, TimeFrame f=Unknown) throw (DayTimeException)
 Calendar time constructor.
 DayTime (long double MJD, TimeFrame f=Unknown) throw (DayTimeException)
 Modified Julian date time constructor.
 DayTime (double MJD, TimeFrame f=Unknown) throw (DayTimeException)
 Modified Julian date time constructor.
 DayTime (short year, short doy, double sod, TimeFrame f=Unknown) throw (DayTimeException)
 Day of year time constructor.
 DayTime (const struct timeval &t, TimeFrame f=Unknown) throw (DayTimeException)
 UNIX time constructor.
 ~DayTime () throw ()
 Destructor.
 DayTime (const DayTime &right) throw (DayTimeException)
 Copy constructor.
DayTimeoperator= (const DayTime &right) throw ()
 Assignment operator.
double operator- (const DayTime &right) const throw ()
 DayTime difference function.
DayTime operator+ (double sec) const throw ()
 Add seconds to this time.
DayTime operator- (double sec) const throw ()
 Subtract seconds from this time.
DayTimeoperator+= (double sec) throw (DayTimeException)
 Add seconds to this time.
DayTimeoperator-= (double sec) throw (DayTimeException)
 Subtract seconds from this time.
DayTimeaddSeconds (double seconds) throw (DayTimeException)
 Add (double) seconds to this time.
DayTimeaddSeconds (long seconds) throw (DayTimeException)
 Add (integer) seconds to this time.
DayTimeaddMilliSeconds (long msec) throw (DayTimeException)
 Add (integer) milliseconds to this time.
DayTimeaddMicroSeconds (long usec) throw (DayTimeException)
 Add (integer) microseconds to this time.
bool operator== (const DayTime &right) const throw ()
 Equality operator.
bool operator!= (const DayTime &right) const throw ()
 Inequality operator.
bool operator< (const DayTime &right) const throw ()
 Comparison operator (less-than).
bool operator> (const DayTime &right) const throw ()
 Comparison operator (greater-than).
bool operator<= (const DayTime &right) const throw ()
 Comparison operator (less-than or equal-to).
bool operator>= (const DayTime &right) const throw ()
 Comparison operator (greater-than or equal-to).
DayTimesetAllButTimeFrame (const DayTime &right) throw (DayTimeException)
 Change time frames via pseudo-copy method.
DayTimesetTimeFrame (TimeFrame f) throw ()
 Set the time frame for this time.
TimeFrame getTimeFrame () const throw ()
 Get the time frame for this time.
double JD () const throw ()
 Get Julian Date JD.
double MJD () const throw ()
 Get Modified Julian Date MJD.
short year () const throw ()
 Get year.
short month () const throw ()
 Get month of year.
short day () const throw ()
 Get day of month.
short dayOfWeek () const throw ()
 Get day of week.
void getYMD (int &yy, int &mm, int &dd) const throw ()
 Get year, month and day of month.
short hour () const throw ()
 Get hour of day.
short minute () const throw ()
 Get minutes of hour.
double second () const throw ()
 Get seconds of minute.
double secOfDay () const throw ()
 Get seconds of day.
short GPS10bitweek () const throw ()
 Get 10-bit GPS week.
long GPSzcount () const throw ()
 Get normal (19 bit) zcount.
long GPSzcountFloor () const throw ()
 Same as GPSzcount() but without rounding to nearest zcount.
double GPSsecond () const throw ()
 Get seconds of week.
double GPSsow () const throw ()
 Get GPS second of week.
short GPSday () const throw ()
 Get day of week.
short GPSfullweek () const throw ()
 Get full (>10 bits) week.
short GPSyear () const throw ()
 Get year.
short DOYyear () const throw ()
 Get year.
short DOYday () const throw ()
 Get day of year.
short DOY () const throw ()
 Get day of year.
double DOYsecond () const throw ()
 Get seconds of day.
double MJDdate () const throw ()
 Get object time as a modified Julian date.
long double getMJDasLongDouble () const throw ()
 Get object time as a (long double) modified Julian date.
timeval unixTime () const throw (DayTimeException)
 Get object time in UNIX timeval structure.
unsigned long fullZcount () const throw ()
 Get time as 32 bit Z count.
unsigned long fullZcountFloor () const throw ()
 Same as fullZcount() but without rounding to nearest zcount.
 operator GPSZcount () const throw (DayTimeException)
 Convert this object to a GPSZcount object.
 operator CommonTime () const throw (DayTimeException)
 Convert this object to a CommonTime object.
DayTimesetYMDHMS (short year, short month, short day, short hour, short min, double sec, TimeFrame f=Unknown) throw (DayTimeException)
 Set the object's time using calendar (Y/M/D) date and ordinary (H:M:S) time.
DayTimesetGPS (short week, double sow, TimeFrame f=Unknown) throw (DayTimeException)
 Set the object's time using GPS time.
DayTimesetGPS (short week, long zcount, TimeFrame f=Unknown) throw (DayTimeException)
 Set the object's time using GPS time (week and Z count).
DayTimesetGPS (short week, long zcount, short year, TimeFrame f=Unknown) throw (DayTimeException)
 Set the object's time using GPS time.
DayTimesetGPS (short week, double sow, short year, TimeFrame f=Unknown) throw (DayTimeException)
 Set the object's time using GPS time.
DayTimesetGPS (unsigned long Zcount, TimeFrame f=Unknown) throw (DayTimeException)
 Set the object's time using GPS time (full Z count).
DayTimesetGPSfullweek (short fullweek, double sow, TimeFrame f=Unknown) throw (DayTimeException)
 Set the object's time using GPS time.
DayTimesetGPSfullweek (short fullweek, long zcount, TimeFrame f=Unknown) throw (DayTimeException)
 Set the object's time using GPS time.
DayTimesetGPSZcount (const GPSZcount &z, TimeFrame f=Unknown) throw (DayTimeException)
 Set the object's time using the given GPSZcount.
DayTimesetCommonTime (const CommonTime &c, TimeFrame f=Unknown) throw ()
 Set the object's time using the give CommonTime.
DayTimesetYDoySod (short year, short day_of_year, double sec_of_day, TimeFrame f=Unknown) throw (DayTimeException)
 Set the object's time using day of year.
DayTimesetMJD (long double mjd, TimeFrame f=Unknown) throw (DayTimeException)
 Set the object's time using (long double) Modified Julian date.
DayTimesetMJDdate (long double mjd, TimeFrame f=Unknown) throw (DayTimeException)
 Same as setMJD.
DayTimesetMJD (double mjd, TimeFrame f=Unknown) throw (DayTimeException)
 Same as setMJD but with input of type double.
DayTimesetMJDdate (double mjd, TimeFrame f=Unknown) throw (DayTimeException)
 Same as setMJD but with input of type double.
DayTimesetUnix (const struct timeval &t, TimeFrame f=Unknown) throw (DayTimeException)
 Set the object's time using POSIX structures.
DayTimesetANSI (const time_t &t, TimeFrame f=Unknown) throw (DayTimeException)
 Set the object's time using ANSI structures.
DayTimesetSystemTime () throw (DayTimeException)
 Set the object's time to the current system time.
DayTimesetLocalTime () throw (DayTimeException)
 Set the object time to the current local time.
DayTimesetYMD (int yy, int mm, int dd, TimeFrame f=Unknown) throw (DayTimeException)
 Set the object using calendar (Y/M/D) date only (time is unchanged).
DayTimesetHMS (int hh, int mm, double sec, TimeFrame f=Unknown) throw (DayTimeException)
 Set the object using ordinary (H:M:S) time only (day is unchanged).
DayTimesetSecOfDay (double sod, TimeFrame f=Unknown) throw (DayTimeException)
 Set the object using seconds of day only (day is unchanged).
DayTimesetYDoy (int yy, int doy, TimeFrame f=Unknown) throw (DayTimeException)
 Set the object using year and day of year only (time is unchanged).
DayTimesetToString (const std::string &str, const std::string &fmt) throw (DayTimeException, FormatException, gpstk::StringUtils::StringException)
 Similar to scanf, this function takes a string and a format describing string in order to read in daytime values.
std::string printf (const char *fmt) const throw (gpstk::StringUtils::StringException)
 Format this time into a string.
std::string printf (const std::string &fmt) const throw (gpstk::StringUtils::StringException)
 Format this time into a string. printf(const char*).
std::string toString (int decimals=0, char datesep='-', char timesep=':') const throw (gpstk::StringUtils::StringException)
 Returns the string formated as '2005-01-01 12:00:00'.
std::string asString () const throw (gpstk::StringUtils::StringException)
 Returns the string that operator<<() would print.
void dump (std::ostream &s) const throw (DayTimeException)
 Dump everything possible, using every get() TD: keep?
void update ()
 Updates the Timestamp with the current time.
double elapsed () const
 Returns the time elapsed since the time.
bool isElapsed (double interval) const
 Returns true if the given interval has passed since the time.

Static Public Member Functions

double setDayTimeTolerance (const double tol) throw ()
 Changes the DAYTIME_TOLERANCE for all DayTime objects.
double getDayTimeTolerance () throw ()
 Returns the current DAYTIME_TOLERANCE.
void convertJDtoCalendar (long jd, int &iyear, int &imonth, int &iday) throw ()
 Fundamental routine to convert from "Julian day" (= JD + 0.5) to calendar day.
long convertCalendarToJD (int iyear, int imonth, int iday) throw ()
 Fundamental routine to convert from calendar day to "Julian day" (= JD + 0.5).
void convertSODtoTime (double sod, int &hh, int &mm, double &sec) throw ()
 Fundamental routine to convert seconds of day to H:M:S.
double convertTimeToSOD (int hh, int mm, double sec) throw ()
 Fundamental routine to convert H:M:S to seconds of day.

Static Public Attributes

DayTime-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.

const long FACTOR = 1000
 time-of-day is stored as long (seconds-of-day)*FACTOR plus double (remaining seconds)/FACTOR
const double JD_TO_MJD = 2400000.5
 Conversion offset, Julian Date to Modified Julian Date.
const long MJD_JDAY = 2400001L
 'Julian day' offset from MJD
const long GPS_EPOCH_JDAY = 2444245L
 'Julian day' of GPS epoch (Jan. 1, 1980).
const long GPS_EPOCH_MJD = 44244L
 Modified Julian Date of GPS epoch (Jan. 1, 1980).
const long UNIX_MJD = 40587L
 Modified Julian Date of UNIX epoch (Jan. 1, 1970).
const long HALFWEEK = 302400
 Seconds per half a GPS week.
const long FULLWEEK = 604800
 Seconds per whole GPS week.
const long SEC_DAY = 86400
 Seconds per day.
const long MS_PER_DAY = SEC_DAY*1000
 Milliseconds in a day.
const double ONE_NSEC_TOLERANCE = 1e-9
 One nanosecond tolerance.
const double ONE_USEC_TOLERANCE = 1e-6
 One microsecond tolerance.
const double ONE_MSEC_TOLERANCE = 1e-3
 One millisecond tolerance.
const double ONE_SEC_TOLERANCE = 1
 One second tolerance.
const double ONE_MIN_TOLERANCE = 60
 One minute tolerance.
const double ONE_HOUR_TOLERANCE = 3600
 One hour tolerance.
double DAYTIME_TOLERANCE = ONE_NSEC_TOLERANCE
 Default tolerance for time equality in days.
const long BEGIN_LIMIT_JDAY = 0
 'julian day' of earliest epoch expressible by DayTime: 1/1/4713 B.C.
const long END_LIMIT_JDAY = 3442448
 'julian day' of latest epoch expressible by DayTime: 1/1/4713 A.D.
const DayTime BEGINNING_OF_TIME
 earliest representable DayTime
const DayTime END_OF_TIME
 latest representable DayTime
bool DAYTIME_TEST_VALID = true
 If true, check the validity of inputs.


Member Enumeration Documentation

enum TimeFrame
 

The various time frames.

Enumeration values:
Unknown  unknown time frame
UTC  Coordinated Universal Time (e.g., from NTP).
LocalSystem  time from a local system clock
GPS_Tx  GPS transmit Time (paper clock) (e.g., 15 smooth).
GPS_Rx  GPS receive time (paper clock).
GPS_SV  SV time frame (e.g., 211 1.5s/6packs).
GPS_Receiver  Receiver time (e.g., 30s, raw 1.5s).

Definition at line 181 of file DayTime.hpp.


Constructor & Destructor Documentation

DayTime  )  throw (DayTimeException)
 

Default constructor.

Initializes to current system time.

Definition at line 167 of file DayTime.cpp.

References DayTime::setSystemTime().

DayTime short  GPSWeek,
double  GPSSecond,
TimeFrame  f = Unknown
throw (DayTimeException)
 

GPS time with full week constructor.

Parameters:
GPSWeek full week number
GPSSecond seconds of week.
f Time frame (see TimeFrame)

Definition at line 178 of file DayTime.cpp.

DayTime short  GPSWeek,
double  GPSSecond,
short  year,
TimeFrame  f = Unknown
throw (DayTimeException)
 

GPS time constructor.

In the case of 10-bit week input, the year and week are used to deduce the number of GPS week rollovers and thus the full GPS week.

Parameters:
GPSWeek week number.
GPSSecond Seconds of week.
year Four-digit year consistent with GPS input.
f Time frame (see TimeFrame)

Definition at line 192 of file DayTime.cpp.

DayTime short  GPSWeek,
long  zcount,
short  year,
TimeFrame  f = Unknown
throw (DayTimeException)
 

GPS time constructor.

In the case of 10-bit week input, the year and week are used to deduce the number of GPS week rollovers and thus the full GPS week.

Parameters:
GPSWeek GPS week number.
zcount Z-count (seconds of week / 1.5)
year Four-digit year consistent with GPS input.
f Time frame (see TimeFrame)

Definition at line 207 of file DayTime.cpp.

DayTime unsigned long  fullZcount,
TimeFrame  f = Unknown
throw (DayTimeException)
 

GPS time constructor given the full Z count.

The number of GPS week rollovers, and therefore the full GPS week, is determined from the current system time.

Parameters:
fullZcount Full z-count (3 MSB unused, mid 10 bits - week number, 19 LSB "normal" z-count).
f Time frame (see TimeFrame)

Definition at line 221 of file DayTime.cpp.

DayTime const GPSZcount z,
TimeFrame  f = Unknown
throw (DayTimeException)
 

GPS Zcount constructor.

The number of GPS week rollovers, and therefore the full GPS week, is determined from the current system time.

Parameters:
z GPSZcount object to set to
f Time frame (see TimeFrame)

Definition at line 232 of file DayTime.cpp.

DayTime const CommonTime c,
TimeFrame  f = Unknown
throw (DayTimeException)
 

CommonTime constructor.

Parameters:
c CommonTime object to set to
f Time frame (see TimeFrame)

Definition at line 243 of file DayTime.cpp.

DayTime short  year,
short  month,
short  day,
short  hour,
short  minute,
double  second,
TimeFrame  f = Unknown
throw (DayTimeException)
 

Calendar time constructor.

This assumes the dates are being specified in Gregorian calender so the days October 5-14 1582 don't exist. Constructing a DayTime with these days will cause an exception to be thrown. See http://www.usno.navy.mil/USNO/astronomical-applications/data-services/jul-date for a reference that this implimentation matches.

Parameters:
year four-digit year.
month month of year (1-based).
day day of month (1-based).
hour hour of day.
minute minutes of hour.
second seconds of minute.
f Time frame (see TimeFrame)

Definition at line 259 of file DayTime.cpp.

References gpstk::min().

DayTime long double  MJD,
TimeFrame  f = Unknown
throw (DayTimeException)
 

Modified Julian date time constructor.

For some compilers, this result may have diminished accuracy.

Parameters:
MJD Modified Julian date as long double.
f Time frame (see TimeFrame)

Definition at line 275 of file DayTime.cpp.

DayTime double  MJD,
TimeFrame  f = Unknown
throw (DayTimeException)
 

Modified Julian date time constructor.

For some compilers, this result may have diminished accuracy.

Parameters:
MJD Modified Julian date as double.
f Time frame (see TimeFrame)

Definition at line 286 of file DayTime.cpp.

DayTime short  year,
short  doy,
double  sod,
TimeFrame  f = Unknown
throw (DayTimeException)
 

Day of year time constructor.

Parameters:
year Four-digit year.
DOY Day of year.
SOD Seconds of day.
f Time frame (see TimeFrame)

Definition at line 299 of file DayTime.cpp.

DayTime const struct timeval &  t,
TimeFrame  f = Unknown
throw (DayTimeException)
 

UNIX time constructor.

Parameters:
t timeval structure (typically from gettimeofday()).
f Time frame (see TimeFrame)

Definition at line 312 of file DayTime.cpp.

~DayTime  )  throw () [inline]
 

Destructor.

Definition at line 434 of file DayTime.hpp.

DayTime const DayTime right  )  throw (DayTimeException)
 

Copy constructor.

Definition at line 324 of file DayTime.cpp.


Member Function Documentation

DayTime & addMicroSeconds long  usec  )  throw (DayTimeException)
 

Add (integer) microseconds to this time.

Parameters:
usec Number of microseconds to increase this time by.
Exceptions:
DayTimeException on over/under-flow

Definition at line 428 of file DayTime.cpp.

DayTime & addMilliSeconds long  msec  )  throw (DayTimeException)
 

Add (integer) milliseconds to this time.

Parameters:
msec Number of milliseconds to increase this time by.
Exceptions:
DayTimeException on over/under-flow

Definition at line 415 of file DayTime.cpp.

DayTime & addSeconds long  seconds  )  throw (DayTimeException)
 

Add (integer) seconds to this time.

Parameters:
seconds Number of seconds to increase this time by.
Exceptions:
DayTimeException on over/under-flow

Definition at line 402 of file DayTime.cpp.

DayTime & addSeconds double  seconds  )  throw (DayTimeException)
 

Add (double) seconds to this time.

Parameters:
seconds Number of seconds to increase this time by.
Exceptions:
DayTimeException on over/under-flow

Definition at line 393 of file DayTime.cpp.

Referenced by DayTime::operator+(), DayTime::operator-(), and testmeth().

std::string asString  )  const throw (gpstk::StringUtils::StringException)
 

Returns the string that operator<<() would print.

Definition at line 1627 of file DayTime.cpp.

Referenced by ConfData::save().

long convertCalendarToJD int  iyear,
int  imonth,
int  iday
throw () [static]
 

Fundamental routine to convert from calendar day to "Julian day" (= JD + 0.5).

Parameters:
iyear reference to integer year
imonth reference to integer month (January == 1)
iday reference to integer day of month (1st day of month == 1)
Returns:
jd long integer "Julian day" = JD+0.5
Note:
range of applicability of this routine is from 0JD (4713BC) to approx 3442448JD (4713AD). Algorithm references: Sinnott, R. W. "Bits and Bytes," Sky & Telescope Magazine, Vol 82, p. 183, August 1991, and The Astronomical Almanac, published by the U.S. Naval Observatory.

Definition at line 1745 of file DayTime.cpp.

Referenced by DayTime::DOY().

void convertJDtoCalendar long  jd,
int &  iyear,
int &  imonth,
int &  iday
throw () [static]
 

Fundamental routine to convert from "Julian day" (= JD + 0.5) to calendar day.

Parameters:
jd long integer "Julian day" = JD+0.5
iyear reference to integer year
imonth reference to integer month (January == 1)
iday reference to integer day of month (1st day of month == 1)
Note:
range of applicability of this routine is from 0JD (4713BC) to approx 3442448JD (4713AD). Algorithm references: Sinnott, R. W. "Bits and Bytes," Sky & Telescope Magazine, Vol 82, p. 183, August 1991, and The Astronomical Almanac, published by the U.S. Naval Observatory.

Definition at line 1696 of file DayTime.cpp.

Referenced by DayTime::day(), DayTime::DOY(), DayTime::month(), and DayTime::year().

void convertSODtoTime double  sod,
int &  hh,
int &  mm,
double &  sec
throw () [static]
 

Fundamental routine to convert seconds of day to H:M:S.

Parameters:
sod seconds of day (input)
hh reference to integer hour (0 <= hh < 24) (output)
mm reference to integer minutes (0 <= mm < 60) (output)
sec reference to double seconds (0 <= sec < 60.0) (output)

Definition at line 1791 of file DayTime.cpp.

Referenced by DayTime::hour(), DayTime::minute(), and DayTime::second().

double convertTimeToSOD int  hh,
int  mm,
double  sec
throw () [static]
 

Fundamental routine to convert H:M:S to seconds of day.

Parameters:
hh integer hour (0 <= hh < 24) (input)
mm integer minutes (0 <= mm < 60) (input)
sec double seconds (0 <= sec < 60.0) (input)
Returns:
sod seconds of day (input)

Definition at line 1817 of file DayTime.cpp.

short day  )  const throw ()
 

Get day of month.

Definition at line 533 of file DayTime.cpp.

References DayTime::convertJDtoCalendar().

Referenced by ConfDataItem::format(), LogChannel::getLogText(), DayTime::setToString(), and testRandomAccessors().

short dayOfWeek  )  const throw ()
 

Get day of week.

Definition at line 542 of file DayTime.cpp.

Referenced by EOPPrediction::getSerialNumber().

short DOY  )  const throw ()
 

Get day of year.

Definition at line 614 of file DayTime.cpp.

References DayTime::convertCalendarToJD(), and DayTime::convertJDtoCalendar().

Referenced by RTFileFrame::getRecord(), NeillTropModel::setAllParameters(), MOPSTropModel::setAllParameters(), NeillTropModel::setDayOfYear(), MOPSTropModel::setDayOfYear(), DayTime::setToString(), and testRandomAccessors().

short DOYday  )  const throw () [inline]
 

Get day of year.

Definition at line 660 of file DayTime.hpp.

Referenced by UTCTime::asGPST(), UTCTime::asTAI(), UTCTime::asUT1(), UTCTime::asUTC(), Msise00Drag::computeDensity(), FICData::generateUniqueKey(), and ObsRngDev::ObsRngDev().

double DOYsecond  )  const throw () [inline]
 

Get seconds of day.

Definition at line 669 of file DayTime.hpp.

Referenced by UTCTime::asGPST(), UTCTime::asTAI(), UTCTime::asUT1(), UTCTime::asUTC(), Msise00Drag::computeDensity(), DayTime::setToString(), and testRandomAccessors().

short DOYyear  )  const throw () [inline]
 

Get year.

Definition at line 655 of file DayTime.hpp.

Referenced by FICData::generateUniqueKey().

void dump std::ostream &  s  )  const throw (DayTimeException)
 

Dump everything possible, using every get() TD: keep?

Definition at line 1636 of file DayTime.cpp.

Referenced by GPSEphemerisStore::dump(), gpstk::operator<<(), and MinSfTest::process().

double elapsed  )  const [inline]
 

Returns the time elapsed since the time.

Definition at line 1125 of file DayTime.hpp.

Referenced by Application::toltalMilliseconds().

unsigned long fullZcount  )  const throw ()
 

Get time as 32 bit Z count.

The 13 MSBs are week modulo 1024, 19 LSBs are seconds of week in Zcounts.

Definition at line 655 of file DayTime.cpp.

References DayTime::GPS10bitweek(), and DayTime::GPSzcount().

unsigned long fullZcountFloor  )  const throw ()
 

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

Definition at line 662 of file DayTime.cpp.

References DayTime::GPS10bitweek(), and DayTime::GPSzcountFloor().

double getDayTimeTolerance  )  throw () [inline, static]
 

Returns the current DAYTIME_TOLERANCE.

Definition at line 265 of file DayTime.hpp.

long double getMJDasLongDouble  )  const throw ()
 

Get object time as a (long double) modified Julian date.

For some compilers, this result may have diminished accuracy.

Definition at line 623 of file DayTime.cpp.

References DayTime::SEC_DAY, and DayTime::secOfDay().

TimeFrame getTimeFrame  )  const throw () [inline]
 

Get the time frame for this time.

Definition at line 563 of file DayTime.hpp.

References gpstk::convertJDtoCalendar().

double getTolerance  )  throw () [inline]
 

Return the tolerance value currently in use by this object.

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

Definition at line 282 of file DayTime.hpp.

void getYMD int &  yy,
int &  mm,
int &  dd
const throw () [inline]
 

Get year, month and day of month.

Definition at line 598 of file DayTime.hpp.

short GPS10bitweek  )  const throw ()
 

Get 10-bit GPS week.

Definition at line 579 of file DayTime.cpp.

References DayTime::GPSfullweek().

Referenced by DayTime::fullZcount(), and DayTime::fullZcountFloor().

short GPSday  )  const throw () [inline]
 

Get day of week.

Definition at line 641 of file DayTime.hpp.

Referenced by FICData::generateUniqueKey(), and DayTime::GPSsow().

short GPSfullweek  )  const throw ()
 

Get full (>10 bits) week.

Definition at line 607 of file DayTime.cpp.

References DayTime::GPS_EPOCH_JDAY.

Referenced by MDPSelftestStatus::encode(), MDPPVTSolution::encode(), MDPHeader::encode(), FICData9::FICData9(), FICData::generateUniqueKey(), EOPPrediction::getSerialNumber(), DayTime::GPS10bitweek(), gpstk::makeEngAlmanac(), gpstk::makeEngEphemeris(), gpstk::makeMDPObsEpoch(), DayTime::operator GPSZcount(), NovatelData::operator RinexNavData(), NovatelData::operator RinexObsData(), MinSfTest::process(), DayTime::setGPS(), and testRandomAccessors().

double GPSsecond  )  const throw () [inline]
 

Get seconds of week.

Definition at line 632 of file DayTime.hpp.

Referenced by EngEphemeris::dump(), MDPSelftestStatus::encode(), MDPPVTSolution::encode(), MDPHeader::encode(), gpstk::makeMDPObsEpoch(), and MinSfTest::process().

double GPSsow  )  const throw ()
 

Get GPS second of week.

Definition at line 600 of file DayTime.cpp.

References DayTime::GPSday(), DayTime::SEC_DAY, and DayTime::secOfDay().

Referenced by DayTime::GPSzcount(), DayTime::GPSzcountFloor(), DayTime::setToString(), and testRandomAccessors().

short GPSyear  )  const throw () [inline]
 

Get year.

Definition at line 650 of file DayTime.hpp.

long GPSzcount  )  const throw ()
 

Get normal (19 bit) zcount.

Definition at line 586 of file DayTime.cpp.

References DayTime::GPSsow().

Referenced by DayTime::fullZcount(), SVPCodeGen::getCurrentSixSeconds(), DayTime::operator GPSZcount(), testMutators(), and testRandomAccessors().

long GPSzcountFloor  )  const throw ()
 

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

Definition at line 593 of file DayTime.cpp.

References DayTime::GPSsow().

Referenced by DayTime::fullZcountFloor().

short hour  )  const throw ()
 

Get hour of day.

Definition at line 549 of file DayTime.cpp.

References DayTime::convertSODtoTime(), and DayTime::secOfDay().

Referenced by ConfDataItem::format(), LogChannel::getLogText(), DayTime::setToString(), and testRandomAccessors().

bool isElapsed double  interval  )  const [inline]
 

Returns true if the given interval has passed since the time.

Definition at line 1128 of file DayTime.hpp.

double JD  )  const throw ()
 

Get Julian Date JD.

Definition at line 502 of file DayTime.cpp.

References DayTime::SEC_DAY, and DayTime::secOfDay().

Referenced by DayTime::MJD().

short minute  )  const throw ()
 

Get minutes of hour.

Definition at line 559 of file DayTime.cpp.

References DayTime::convertSODtoTime(), and DayTime::secOfDay().

Referenced by ConfDataItem::format(), LogChannel::getLogText(), DayTime::setToString(), and testRandomAccessors().

double MJD  )  const throw ()
 

Get Modified Julian Date MJD.

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

Definition at line 508 of file DayTime.cpp.

References DayTime::JD().

Referenced by UTCTime::asTDB(), EOPPrediction::computeEOP(), SphericalHarmonicGravity::correctCSTides(), ReferenceFrames::doodsonArguments(), ReferenceFrames::earthRotationAngle(), EOPStore::getEOP(), gpstk::GPST2UTC(), ReferenceFrames::iauEqeq94(), ReferenceFrames::iauGmst00(), ReferenceFrames::iauGmst82(), ReferenceFrames::iauPmat76(), ReferenceFrames::meanObliquity(), ReferenceFrames::nutationAngles(), gpstk::TAI2UTC(), SunForce::test(), testMutators(), testRandomAccessors(), gpstk::TT2UTC(), gpstk::UT12UTC(), and SolarSystem::WGS84Position().

double MJDdate  )  const throw () [inline]
 

Get object time as a modified Julian date.

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

Definition at line 676 of file DayTime.hpp.

short month  )  const throw ()
 

Get month of year.

Definition at line 524 of file DayTime.cpp.

References DayTime::convertJDtoCalendar().

Referenced by ConfDataItem::format(), LogChannel::getLogText(), DayTime::setToString(), and testRandomAccessors().

operator CommonTime  )  const throw (DayTimeException)
 

Convert this object to a CommonTime object.

Exceptions:
DayTimeException if this DayTime's current state doesn't constitute a valid CommonTime.

Definition at line 690 of file DayTime.cpp.

References DayTime::FACTOR, and GPSTK_THROW.

operator GPSZcount  )  const throw (DayTimeException)
 

Convert this object to a GPSZcount object.

Exceptions:
DayTimeException if this DayTime's current state doesn't constitute a valid GPS Z-count.

Definition at line 668 of file DayTime.cpp.

References DayTime::GPSfullweek(), GPSTK_THROW, and DayTime::GPSzcount().

bool operator!= const DayTime right  )  const throw ()
 

Inequality operator.

Definition at line 453 of file DayTime.cpp.

References gpstk::operator==().

DayTime operator+ double  sec  )  const throw ()
 

Add seconds to this time.

Parameters:
sec Number of seconds to increase this time by.
Returns:
The new time incremented by sec.

Definition at line 358 of file DayTime.cpp.

References DayTime::addSeconds().

DayTime & operator+= double  sec  )  throw (DayTimeException)
 

Add seconds to this time.

Parameters:
sec Number of seconds to increase this time by.
Exceptions:
DayTimeException on over/under-flow

Definition at line 375 of file DayTime.cpp.

DayTime operator- double  sec  )  const throw ()
 

Subtract seconds from this time.

Parameters:
sec Number of seconds to decrease this time by.
Returns:
The new time decremented by sec.

Definition at line 367 of file DayTime.cpp.

References DayTime::addSeconds().

double operator- const DayTime right  )  const throw ()
 

DayTime difference function.

Parameters:
right DayTime to subtract from this one.
Returns:
difference in seconds.

Definition at line 348 of file DayTime.cpp.

DayTime & operator-= double  sec  )  throw (DayTimeException)
 

Subtract seconds from this time.

Parameters:
sec Number of seconds to decrease this time by.
Exceptions:
DayTimeException on over/under-flow

Definition at line 384 of file DayTime.cpp.

bool operator< const DayTime right  )  const throw ()
 

Comparison operator (less-than).

Definition at line 459 of file DayTime.cpp.

References gpstk::operator-().

bool operator<= const DayTime right  )  const throw ()
 

Comparison operator (less-than or equal-to).

Definition at line 473 of file DayTime.cpp.

References gpstk::operator>().

DayTime & operator= const DayTime right  )  throw ()
 

Assignment operator.

Definition at line 332 of file DayTime.cpp.

References DayTime::jday, DayTime::mSec, DayTime::mSod, DayTime::timeFrame, and DayTime::tolerance.

bool operator== const DayTime right  )  const throw ()
 

Equality operator.

Returns:
true if ABS(*this - right) <= lesser of tolerance and right.tolerance; false otherwise

Definition at line 445 of file DayTime.cpp.

References ABS.

bool operator> const DayTime right  )  const throw ()
 

Comparison operator (greater-than).

Definition at line 466 of file DayTime.cpp.

References gpstk::operator-().

bool operator>= const DayTime right  )  const throw ()
 

Comparison operator (greater-than or equal-to).

Definition at line 479 of file DayTime.cpp.

References gpstk::operator<().

std::string printf const std::string &  fmt  )  const throw (gpstk::StringUtils::StringException) [inline]
 

Format this time into a string. printf(const char*).

Definition at line 1104 of file DayTime.hpp.

string printf const char *  fmt  )  const throw (gpstk::StringUtils::StringException)
 

Format this time into a string.

Note:
Whenever a format is added or removed from the DayTime 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 DayTime or FileSpec.
Generate and return a string containing a formatted date, formatted by the specification fmt.

Warning:
See above note.
Parameters:
fmt format to use for this time.
Returns:
a string containing this time in the representation specified by fmt.

Definition at line 1553 of file DayTime.cpp.

References gpstk::StringUtils::formattedPrint().

Referenced by GDCPass::detectObviousSlips(), GDCPass::detectWLslips(), GDCPass::detectWLsmallSlips(), dtft(), SP3Data::dump(), SatPass::dump(), RinexObsHeader::dump(), EOPStore::dump(), AntexData::dump(), GPSEphemerisStore::findNearEphemeris(), GPSEphemerisStore::findUserEphemeris(), GDCPass::foundWLsmallSlip(), SVNumXRef::getNAVSTAR(), SVNumXRef::getPRNID(), main(), gpstk::operator<<(), GDCPass::preprocess(), SolarSystem::readASCIIdata(), PlanetEphemeris::readASCIIdata(), RinexNavHeader::reallyPutRecord(), RinexMetHeader::reallyPutRecord(), RinexGloNavHeader::reallyPutRecord(), gpstk::SatPassFromRinexFiles(), testConstructors(), testMutators(), FileSpec::toString(), TimeNamedFileStream::updateFileName(), GDCPass::WLconsistencyCheck(), GDCPass::WLsigmaStrip(), GDCPass::WLslipFix(), and RinexObsHeader::WriteHeaderRecords().

double secOfDay  )  const throw () [inline]
 

Get seconds of day.

Definition at line 615 of file DayTime.hpp.

Referenced by EOPPrediction::computeEOP(), DayTime::getMJDasLongDouble(), DayTime::GPSsow(), DayTime::hour(), DayTime::JD(), DayTime::minute(), and DayTime::second().

double second  )  const throw ()
 

Get seconds of minute.

Definition at line 569 of file DayTime.cpp.

References DayTime::convertSODtoTime(), and DayTime::secOfDay().

Referenced by GPSEphemerisStore::addEphemeris(), LinearClockModel::addEpoch(), GPSEphemerisStore::addToList(), RinexObsData::dump(), RinexMetData::dump(), LinearClockModel::dump(), GPSEphemerisStore::dump(), EOPStore::dump(), GPSEphemerisStore::edit(), GPSAlmanacStore::findAlmanac(), GPSAlmanacStore::findMostRecentAlmanac(), GPSEphemerisStore::findNearEphemeris(), GPSEphemerisStore::findUserEphemeris(), ConfDataItem::format(), EpochDataStore::getData(), LogChannel::getLogText(), TabularEphemerisStore::getXvt(), gpstk::makeEngAlmanac(), gpstk::makeEngEphemeris(), gpstk::makeObsEpoch(), gpstk::makeRinexObsData(), DayTime::setToString(), testRandomAccessors(), and GPSEphemerisStore::ubeSize().

DayTime & setAllButTimeFrame const DayTime right  )  throw (DayTimeException)
 

Change time frames via pseudo-copy method.

Copies all of right except the time frame, which remains unchanged.

Parameters:
right DayTime object to copy time from.
Exceptions:
DayTimeException 

Definition at line 487 of file DayTime.cpp.

DayTime & setANSI const time_t &  t,
TimeFrame  f = Unknown
throw (DayTimeException)
 

Set the object's time using ANSI structures.

This uses the ANSI C/C++ time_t struct to set the time. This structure represents the time with a resolution of seconds.

Parameters:
t time to set
f Time frame (see TimeFrame)
Returns:
a reference to this object.

Definition at line 993 of file DayTime.cpp.

Referenced by DayTime::setSystemTime().

DayTime & setCommonTime const CommonTime c,
TimeFrame  f = Unknown
throw ()
 

Set the object's time using the give CommonTime.

Parameters:
c the CommonTime object to set to
f Time frame (see TimeFrame))
Returns:
a reference to this object.

Definition at line 923 of file DayTime.cpp.

double setDayTimeTolerance const double  tol  )  throw () [inline, static]
 

Changes the DAYTIME_TOLERANCE for all DayTime objects.

Definition at line 260 of file DayTime.hpp.

Referenced by main().

DayTime & setGPS unsigned long  Zcount,
TimeFrame  f = Unknown
throw (DayTimeException)
 

Set the object's time using GPS time (full Z count).

The number of GPS week rollovers, and therefore the full GPS week, is determined from the current system time.

Parameters:
Zcount Full z-count (3 MSB unused, mid 10 bits - week number, 19 LSB "normal" z-count).
f Time frame (see TimeFrame)
Returns:
a reference to this object.

Definition at line 857 of file DayTime.cpp.

References GPSTK_THROW.

DayTime & setGPS short  week,
double  sow,
short  year,
TimeFrame  f = Unknown
throw (DayTimeException)
 

Set the object's time using GPS time.

In case of 10-bit week input, the year and week are used to deduce the number of GPS week rollovers and thus the full GPS week; prefer setGPSfullweek().

Parameters:
week GPS week number.
sow GPS seconds of week.
year Four-digit year consistent with GPS input.
f Time frame (see TimeFrame)
Returns:
a reference to this object.

Definition at line 787 of file DayTime.cpp.

References DayTime::GPSfullweek(), GPSTK_THROW, and DayTime::setYMD().

DayTime & setGPS short  week,
long  zcount,
short  year,
TimeFrame  f = Unknown
throw (DayTimeException)
 

Set the object's time using GPS time.

In case of 10-bit week input, the year and week are used to deduce the number of GPS week rollovers and thus the full GPS week; prefer setGPSfullweek().

Parameters:
week GPS week number.
zcount GPS Z-count (seconds of week / 1.5)
year Four-digit year consistent with GPS input.
f Time frame (see TimeFrame)
Returns:
a reference to this object.

Definition at line 770 of file DayTime.cpp.

DayTime & setGPS short  week,
long  zcount,
TimeFrame  f = Unknown
throw (DayTimeException)
 

Set the object's time using GPS time (week and Z count).

In the case of 10-bit week input, the number of GPS week rollovers, and therefore the full GPS week, is determined from the current system time; prefer setGPSfullweek().

Parameters:
week GPS week number.
zcount Z-count (seconds of week / 1.5)
f Time frame (see TimeFrame)
Returns:
a reference to this object.

Definition at line 756 of file DayTime.cpp.

DayTime & setGPS short  week,
double  sow,
TimeFrame  f = Unknown
throw (DayTimeException)
 

Set the object's time using GPS time.

In the case of 10-bit week input, the number of GPS week rollovers, and therefore the full GPS week, is determined from the current system time.

Parameters:
week GPS week number.
sow GPS seconds of week.
f Time frame (see TimeFrame)
Returns:
a reference to this object.

Definition at line 736 of file DayTime.cpp.

References DayTime::GPSfullweek(), and DayTime::setSystemTime().

Referenced by gpstk::makeMDPObsEpoch(), gpstk::makeMDPPVTSolution(), DayTime::setToString(), and testMutators().

DayTime& setGPSfullweek short  fullweek,
long  zcount,
TimeFrame  f = Unknown
throw (DayTimeException) [inline]
 

Set the object's time using GPS time.

Parameters:
fullweek Full (i.e. >10bits) GPS week number.
zcount Z-count (seconds of week / 1.5)
f Time frame (see TimeFrame)
Returns:
a reference to this object.

Definition at line 833 of file DayTime.hpp.

DayTime & setGPSfullweek short  fullweek,
double  sow,
TimeFrame  f = Unknown
throw (DayTimeException)
 

Set the object's time using GPS time.

Parameters:
fullweek Full (i.e. >10bits) GPS week number.
sow Seconds of week.
f Time frame (see TimeFrame)
Returns:
a reference to this object.

Definition at line 882 of file DayTime.cpp.

References gpstk::StringUtils::asString(), gpstk::FULLWEEK, gpstk::GPS_EPOCH_JDAY, and GPSTK_THROW.

Referenced by MDPHeader::decode(), FICData::generateUniqueKey(), EngEphemeris::getEphemerisEpoch(), EngEphemeris::getEpochTime(), EOPPrediction::getSerialNumber(), AlmOrbit::getToaTime(), FICData::getTransmitTime(), EngEphemeris::getTransmitTime(), AlmOrbit::getTransmitTime(), and DayTime::setToString().

DayTime & setGPSZcount const GPSZcount z,
TimeFrame  f = Unknown
throw (DayTimeException)
 

Set the object's time using the given GPSZcount.

The number of GPS week rollovers, and therefore the full GPS week, is determined from the current system time.

Parameters:
z the GPSZcount object to set to
f Time frame (see TimeFrame)
Returns:
a reference to this object.

Definition at line 911 of file DayTime.cpp.

DayTime & setHMS int  hh,
int  mm,
double  sec,
TimeFrame  f = Unknown
throw (DayTimeException)
 

Set the object using ordinary (H:M:S) time only (day is unchanged).

Parameters:
hh hour of day.
mm minutes of hour.
sec seconds of minute.
f Time frame (see TimeFrame)
Returns:
a reference to this object.

Definition at line 1070 of file DayTime.cpp.

References ABS, gpstk::StringUtils::asString(), gpstk::convertSODtoTime(), gpstk::convertTimeToSOD(), and GPSTK_THROW.

Referenced by testMutators().

DayTime & setLocalTime  )  throw (DayTimeException)
 

Set the object time to the current local time.

Definition at line 1027 of file DayTime.cpp.

References DayTime::setYMDHMS().

Referenced by Logger::log(), RinexNavHeader::reallyPutRecord(), RinexMetHeader::reallyPutRecord(), RinexGloNavHeader::reallyPutRecord(), and RinexObsHeader::WriteHeaderRecords().

DayTime& setMJD double  mjd,
TimeFrame  f = Unknown
throw (DayTimeException) [inline]
 

Same as setMJD but with input of type double.

Definition at line 893 of file DayTime.hpp.

DayTime & setMJD long double  mjd,
TimeFrame  f = Unknown
throw (DayTimeException)
 

Set the object's time using (long double) Modified Julian date.

This just sets the time to the indicated modified Julian date.

Parameters:
mjd date/time to set, in MJD.
f Time frame (see TimeFrame)
Returns:
a reference to this object.

Definition at line 955 of file DayTime.cpp.

References GPSTK_THROW, and gpstk::MJD_JDAY.

Referenced by EOPPrediction::computeEOP(), EOPStore::dump(), SolarSystem::endTime(), PlanetEphemeris::endTime(), EarthOceanTide::getOceanTide(), EOPPrediction::getSerialNumber(), SolarSystem::readASCIIdata(), PlanetEphemeris::readASCIIdata(), DayTime::setToString(), SolarSystem::startTime(), PlanetEphemeris::startTime(), HarrisPriesterDrag::test(), testMutators(), and testRandomAccessors().

DayTime& setMJDdate double  mjd,
TimeFrame  f = Unknown
throw (DayTimeException) [inline]
 

Same as setMJD but with input of type double.

Definition at line 899 of file DayTime.hpp.

DayTime& setMJDdate long double  mjd,
TimeFrame  f = Unknown
throw (DayTimeException) [inline]
 

Same as setMJD.

Definition at line 887 of file DayTime.hpp.

DayTime & setSecOfDay double  sod,
TimeFrame  f = Unknown
throw (DayTimeException)
 

Set the object using seconds of day only (day is unchanged).

Parameters:
sod seconds of day.

Definition at line 1095 of file DayTime.cpp.

References GPSTK_THROW.

Referenced by testMutators().

DayTime & setSystemTime  )  throw (DayTimeException)
 

Set the object's time to the current system time.

If the POSIX gettimeofday() system call is available, it is used to determine system time. If the gettimeofday() call is not available, the ANSI time() system call is used to determine system time.

Returns:
a reference to this object.

Definition at line 1004 of file DayTime.cpp.

References DayTime::LocalSystem, DayTime::setANSI(), and DayTime::setUnix().

Referenced by DayTime::DayTime(), main(), and DayTime::setGPS().

DayTime& setTimeFrame TimeFrame  f  )  throw () [inline]
 

Set the time frame for this time.

Definition at line 558 of file DayTime.hpp.

DayTime & setTolerance const double  tol  )  throw ()
 

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:
tol Tolerance in days to be used by comparison operators.
See also:
DayTime-Specific Definitions

Definition at line 157 of file DayTime.cpp.

Referenced by main().

DayTime & setToString const std::string &  str,
const std::string &  fmt
throw (DayTimeException, FormatException, gpstk::StringUtils::StringException)
 

Similar to scanf, this function takes a string and a format describing string in order to read in daytime 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
  %F                %w %g %Z
  %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:
str string to get date/time from.
fmt format to use to parse str.
Exceptions:
DayTimeException if fmt is an incomplete specification
FormatException if unable to scan str.
StringException if an error occurs manipulating the str or fmt strings.
Returns:
a reference to this object.

Definition at line 1140 of file DayTime.cpp.

References Exception::addText(), gpstk::StringUtils::asDouble(), gpstk::StringUtils::asInt(), DayTime::day(), DayTime::DOY(), DayTime::DOYsecond(), gpstk::StringUtils::firstWord(), DayTime::GPSsow(), GPSTK_THROW, DayTime::hour(), gpstk::StringUtils::isLike(), gpstk::StringUtils::lowerCase(), DayTime::minute(), DayTime::month(), DayTime::second(), DayTime::setGPS(), DayTime::setGPSfullweek(), DayTime::setMJD(), DayTime::setUnix(), DayTime::setYDoySod(), DayTime::setYMDHMS(), gpstk::StringUtils::stripLeading(), DayTime::unixTime(), and DayTime::year().

Referenced by SVExclusionList::addFile(), CommandOptionWithTimeArg::checkArguments(), FileSpec::extractDayTime(), and main().

DayTime & setUnix const struct timeval &  t,
TimeFrame  f = Unknown
throw (DayTimeException)
 

Set the object's time using POSIX structures.

This uses the POSIX timeval struct to set the time. This structure represents the time with a resolution of microseconds.

Parameters:
t time to set
f Time frame (see TimeFrame)
Returns:
a reference to this object.

Definition at line 980 of file DayTime.cpp.

References gpstk::MJD_JDAY, and gpstk::UNIX_MJD.

Referenced by DayTime::setSystemTime(), and DayTime::setToString().

DayTime & setYDoy int  yy,
int  doy,
TimeFrame  f = Unknown
throw (DayTimeException)
 

Set the object using year and day of year only (time is unchanged).

Parameters:
sod seconds of day.

Definition at line 1116 of file DayTime.cpp.

References gpstk::convertCalendarToJD(), gpstk::convertJDtoCalendar(), and GPSTK_THROW.

Referenced by testMutators().

DayTime & setYDoySod short  year,
short  day_of_year,
double  sec_of_day,
TimeFrame  f = Unknown
throw (DayTimeException)
 

Set the object's time using day of year.

Parameters:
year Four-digit year.
day_of_year Day of year.
sec_of_day Seconds of day.
f Time frame (see TimeFrame)
Returns:
a reference to this object.

Definition at line 940 of file DayTime.cpp.

Referenced by RTFileFrame::getRecord(), DayTime::setToString(), and gpstk::UT12UTC().

DayTime & setYMD int  yy,
int  mm,
int  dd,
TimeFrame  f = Unknown
throw (DayTimeException)
 

Set the object using calendar (Y/M/D) date only (time is unchanged).

Parameters:
yy four-digit year.
mm month of year (1-based).
dd day of month (1-based).
f Time frame (see TimeFrame)
Returns:
a reference to this object.

Definition at line 1043 of file DayTime.cpp.

References gpstk::convertCalendarToJD(), gpstk::convertJDtoCalendar(), and GPSTK_THROW.

Referenced by DayTime::setGPS(), and testMutators().

DayTime & setYMDHMS short  year,
short  month,
short  day,
short  hour,
short  min,
double  sec,
TimeFrame  f = Unknown
throw (DayTimeException)
 

Set the object's time using calendar (Y/M/D) date and ordinary (H:M:S) time.

Parameters:
year four-digit year.
month month of year (1-based).
day day of month (1-based).
hour hour of day.
min minutes of hour.
sec seconds of minute.
f Time frame (see TimeFrame)
Returns:
a reference to this object.

Definition at line 717 of file DayTime.cpp.

References gpstk::min().

Referenced by EOPPrediction::getSerialNumber(), SatOrbitStore::loadGNV1BFile(), ProblemSatFilter::loadSatelliteProblemFile(), ConfDataItem::parse(), DayTime::setLocalTime(), DayTime::setToString(), and testMutators().

std::string toString int  decimals = 0,
char  datesep = '-',
char  timesep = ':'
const throw (gpstk::StringUtils::StringException)
 

Returns the string formated as '2005-01-01 12:00:00'.

Definition at line 1611 of file DayTime.cpp.

struct timeval unixTime  )  const throw (DayTimeException)
 

Get object time in UNIX timeval structure.

Definition at line 632 of file DayTime.cpp.

References gpstk::MJD_JDAY, and gpstk::UNIX_MJD.

Referenced by DayTime::setToString().

void update  )  [inline]
 

Updates the Timestamp with the current time.

Definition at line 1122 of file DayTime.hpp.

Referenced by Application::main().

short year  )  const throw ()
 

Get year.

Definition at line 515 of file DayTime.cpp.

References DayTime::convertJDtoCalendar().

Referenced by ConfDataItem::format(), LogChannel::getLogText(), RTFileFrame::getRecord(), EOPPrediction::getSerialNumber(), gpstk::parseTime(), DayTime::setToString(), and testRandomAccessors().


Member Data Documentation

const long BEGIN_LIMIT_JDAY = 0 [static]
 

'julian day' of earliest epoch expressible by DayTime: 1/1/4713 B.C.

Definition at line 140 of file DayTime.cpp.

const DayTime BEGINNING_OF_TIME [static]
 

Initial value:

      DayTime(DayTime::BEGIN_LIMIT_JDAY, 0, 0.0, DayTime::DAYTIME_TOLERANCE)
earliest representable DayTime

Definition at line 145 of file DayTime.cpp.

bool DAYTIME_TEST_VALID = true [static]
 

If true, check the validity of inputs.

Throw DayTimeException on failure.

Definition at line 153 of file DayTime.cpp.

double DAYTIME_TOLERANCE = ONE_NSEC_TOLERANCE [static]
 

Default tolerance for time equality in days.

Definition at line 136 of file DayTime.cpp.

const long END_LIMIT_JDAY = 3442448 [static]
 

'julian day' of latest epoch expressible by DayTime: 1/1/4713 A.D.

Definition at line 143 of file DayTime.cpp.

const DayTime END_OF_TIME [static]
 

Initial value:

      DayTime(DayTime::END_LIMIT_JDAY, 0, 0.0, DayTime::DAYTIME_TOLERANCE)
latest representable DayTime

Definition at line 148 of file DayTime.cpp.

const long FACTOR = 1000 [static]
 

time-of-day is stored as long (seconds-of-day)*FACTOR plus double (remaining seconds)/FACTOR

Definition at line 97 of file DayTime.cpp.

Referenced by DayTime::operator CommonTime().

const long FULLWEEK = 604800 [static]
 

Seconds per whole GPS week.

Definition at line 102 of file DayTime.cpp.

const long GPS_EPOCH_JDAY = 2444245L [static]
 

'Julian day' of GPS epoch (Jan. 1, 1980).

Definition at line 113 of file DayTime.cpp.

Referenced by DayTime::GPSfullweek().

const long GPS_EPOCH_MJD = 44244L [static]
 

Modified Julian Date of GPS epoch (Jan. 1, 1980).

Definition at line 115 of file DayTime.cpp.

const long HALFWEEK = 302400 [static]
 

Seconds per half a GPS week.

Definition at line 100 of file DayTime.cpp.

const double JD_TO_MJD = 2400000.5 [static]
 

Conversion offset, Julian Date to Modified Julian Date.

Definition at line 109 of file DayTime.cpp.

const long MJD_JDAY = 2400001L [static]
 

'Julian day' offset from MJD

Definition at line 111 of file DayTime.cpp.

const long MS_PER_DAY = SEC_DAY*1000 [static]
 

Milliseconds in a day.

Definition at line 106 of file DayTime.cpp.

const double ONE_HOUR_TOLERANCE = 3600 [static]
 

One hour tolerance.

Definition at line 130 of file DayTime.cpp.

const double ONE_MIN_TOLERANCE = 60 [static]
 

One minute tolerance.

Definition at line 128 of file DayTime.cpp.

const double ONE_MSEC_TOLERANCE = 1e-3 [static]
 

One millisecond tolerance.

Definition at line 124 of file DayTime.cpp.

const double ONE_NSEC_TOLERANCE = 1e-9 [static]
 

One nanosecond tolerance.

Definition at line 120 of file DayTime.cpp.

const double ONE_SEC_TOLERANCE = 1 [static]
 

One second tolerance.

Definition at line 126 of file DayTime.cpp.

const double ONE_USEC_TOLERANCE = 1e-6 [static]
 

One microsecond tolerance.

Definition at line 122 of file DayTime.cpp.

const long SEC_DAY = 86400 [static]
 

Seconds per day.

Definition at line 104 of file DayTime.cpp.

Referenced by DayTime::getMJDasLongDouble(), DayTime::GPSsow(), and DayTime::JD().

const long UNIX_MJD = 40587L [static]
 

Modified Julian Date of UNIX epoch (Jan. 1, 1970).

Definition at line 117 of file DayTime.cpp.


The documentation for this class was generated from the following files:
Generated on Mon Jun 18 03:31:35 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1