CommonTime Class Reference

#include <CommonTime.hpp>

Collaboration diagram for CommonTime:

Collaboration graph
[legend]
List of all members.

Detailed Description

This is the common time format that all time formats convert to when converting between themselves.

This allows the decoupling of inter-format conversions.

The interface is based on three quantites: days, seconds of day, and fractional seconds of day. The internal representation, however, is slightly different. It consists of a day, milliseconds of day, and fractional seconds of day. Their valid ranges are shown below:

Quantity >= < -------- --- --- day 0 2^31 msod 0 86400000 fsod 0 0.001

The above is somewhat difficult to grasp at first, but the reason for keeping the fractional part of time in units of seconds is due to the fact that the time formats usually break at seconds and partial seconds not at milliseconds and partial milliseconds. By keeping the value in seconds, we save ourselves additional work and loss of precision through conversion of fractional seconds to fractional milliseconds.

Definition at line 57 of file CommonTime.hpp.

Public Member Functions

 CommonTime (long day=0, long sod=0, double fsod=0.0) throw ( gpstk::InvalidParameter )
 Default Constructor.
 CommonTime (long day, double sod) throw ( gpstk::InvalidParameter )
 Constructor that accepts days and second of day.
 CommonTime (double day) throw ( gpstk::InvalidParameter )
 Constructor that accepts days only.
 CommonTime (const CommonTime &right) throw ()
 Copy Constructor.
CommonTimeoperator= (const CommonTime &right) throw ()
 Assignment Operator.
virtual ~CommonTime () throw ()
 Destructor.
CommonTimeset (long day, long sod, double fsod=0.0) throw ( gpstk::InvalidParameter )
 Set method that accepts values for day, seconds of day and fractional seconds of day.
CommonTimeset (long day, double sod=0.0) throw ( gpstk::InvalidParameter )
 Set method that accepts values for day and seconds of day.
CommonTimeset (double day) throw ( gpstk::InvalidParameter )
 Set method that accepts a value for day.
CommonTimesetInternal (long day=0, long msod=0, double fsod=0.0) throw ( gpstk::InvalidParameter )
 Set internal values method.
void get (long &day, long &sod, double &fsod) const throw ()
 Get method.
void get (long &day, double &sod) const throw ()
 Get method through which one may obtain values for day and second of day which includes the fractional second of day.
void get (double &day) const throw ()
 Get method through which one may obtain a value for day which includes the fraction of a day.
void getInternal (long &day, long &msod, double &fsod) const throw ()
 Get internal values method.
double getDays () const throw ()
 Obtain the time, in days, including the fraction of a day.
double getSecondOfDay () const throw ()
 Obtain the seconds of day ( ignoring the day ).
double operator- (const CommonTime &right) const throw ()
 Difference two Common Time objects.
CommonTime operator+ (double seconds) const throw ( InvalidRequest )
 Add seconds to a copy of this CommonTime.
CommonTime operator- (double seconds) const throw ( InvalidRequest )
 Subtract seconds from a copy of this CommonTime.
CommonTimeoperator+= (double seconds) throw ( InvalidRequest )
 Add seconds to this CommonTime.
CommonTimeoperator-= (double seconds) throw ( InvalidRequest )
 Subtract seconds from this CommonTime.
CommonTimeaddSeconds (double seconds) throw ( InvalidRequest )
 Add seconds to this CommonTime object.
CommonTimeaddDays (long days) throw ( InvalidRequest )
 Add integer days to this CommonTime object.
CommonTimeaddSeconds (long seconds) throw ( InvalidRequest )
 Add integer seconds to this CommonTime object.
CommonTimeaddMilliseconds (long ms) throw ( InvalidRequest )
 Add integer milliseconds to this CommonTime object.
bool operator== (const CommonTime &right) const throw ()
bool operator!= (const CommonTime &right) const throw ()
bool operator< (const CommonTime &right) const throw ()
bool operator> (const CommonTime &right) const throw ()
bool operator<= (const CommonTime &right) const throw ()
bool operator>= (const CommonTime &right) const throw ()
void reset () throw ()
std::string asString () const throw ()

Static Public Attributes

const long BEGIN_LIMIT_JDAY = 0
 'julian day' of earliest epoch expressible by CommonTime: 1/1/4713 B.C.
const long END_LIMIT_JDAY = 3442448
 'julian day' of latest epoch expressible by CommonTime: 1/1/4713 A.D.
const CommonTime BEGINNING_OF_TIME
 earliest representable CommonTime
const CommonTime END_OF_TIME
 latest representable CommonTime

Protected Member Functions

bool add (long days, long msod, double fsod) throw ()
 protected functions
bool normalize () throw ()
 Normalize the values.

Protected Attributes

long m_day
long m_msod
double m_fsod


Member Function Documentation

bool add long  days,
long  msod,
double  fsod
throw () [protected]
 

protected functions

Parameters:
days the number of days to add
msod the number of milliseconds to add
fsod the number of fractional seconds to add
Returns:
the result of calling the normalize() function

Definition at line 352 of file CommonTime.cpp.

References gpstk::normalize().

std::string asString  )  const throw ()
 

Definition at line 339 of file CommonTime.cpp.

References CommonTime::m_day, and CommonTime::m_msod.

Referenced by gpstk::operator<<().

bool normalize  )  throw () [protected]
 

Normalize the values.

This takes out of bounds values and rolls other values appropriately.

Returns:
true if m_day is valid, false otherwise

Definition at line 363 of file CommonTime.cpp.

References ABS, CommonTime::m_day, CommonTime::m_fsod, and CommonTime::m_msod.

void reset void   )  throw () [inline]
 

Definition at line 325 of file CommonTime.hpp.


Member Data Documentation

long m_day [protected]
 

Definition at line 352 of file CommonTime.hpp.

Referenced by CommonTime::asString(), and CommonTime::normalize().

double m_fsod [protected]
 

Definition at line 354 of file CommonTime.hpp.

Referenced by CommonTime::normalize().

long m_msod [protected]
 

Definition at line 353 of file CommonTime.hpp.

Referenced by CommonTime::asString(), and CommonTime::normalize().


The documentation for this class was generated from the following files:
Generated on Thu Feb 9 03:31:34 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1