Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

O_SESSAME::ssfTime Class Reference
[Time Utilities]

#include <Time.h>

List of all members.


Detailed Description

Simulation Time object.

ssfTime is used to encapsulate a representation of time and provide the functionality for converting between different time representations (ie Mean Solar, Sidereal, Julian Date, etc.) The ssfTime object includes both a stored time, as well as an epoch that the time can be measured from.

Example:
 ssfTime simTime;
 ssfSeconds integrationTime = 10;
 simTime.Set(integrationTime);
 
 ssfTime nowTime(Now());

Definition at line 75 of file Time.h.

Public Member Functions

 ssfTime ()
 Default constructor. Initializes the time to 0 seconds.
 ssfTime (tm _Time)
 Constructor creates a time object as a copy of a time struct.
 ssfTime (timeval _Time)
 Constructor creates a time object as a copy of a timeval struct.
 ssfTime (ssfSeconds _Time)
 Constructor creates time object based on number of seconds.
 ssfTime (int year, int month, int day, int hour, int minute, double seconds)
 Constructor creates time object based on a calendar date.
void Set (tm _newTime)
 Set the ssfTime object to a specified time struct.
void Set (timeval _Time)
 Set the time object as a copy of a timeval struct.
void Set (ssfSeconds _newTime)
 Set the ssfTime object to a specified time in seconds.
void SetJulianDate (ssfJulianDate _newJD)
 Set the ssfTime object to a specified Julian Date.
void SetEpochJulianDate (ssfJulianDate _newJD)
 Set the Epoch to a specified Julian Date.
void Set (int year, int month, int day, int hour, int minute, double seconds)
 Set the ssfTime object based on a calendar date.
void SetTimeAfterEpoch (ssfSeconds _timeAfter)
 Set the current time after epoch.
void SetEpoch (ssfSeconds _newEpochTime)
 Set the epoch time.
void SetEpoch (tm _newEpochTime)
 Set the epoch time.
void SetEpoch (const timeval &_Time)
 Set the epoch time from a timeval struct.
void SetEpoch (int year, int month, int day, int hour, int minute, double seconds)
 Set the epoch of the ssfTime object based on a calendar date.
ssfSeconds GetSeconds () const
 Return the current time in seconds.
tm GetDateTime () const
 Return a tm struct of the date, time of the stored time.
tm GetEpochDateTime () const
 Return the epoch in a tm struct of the date-time .
ssfSeconds GetEpoch () const
 Return the current Epoch.
ssfJulianDate GetJulianDate () const
 Get the Julian Date of the time object.
ssfJulianDate GetEpochJulianDate () const
 Get the Julian Date of the time object's epoch.
Angle GetGreenwichMeanSiderealTime () const
 Calculate the Greenwich sidereal time of the stored time.
Angle GetEpochGreenwichMeanSiderealTime () const
 Get the Julian Date of the time object's epoch.
ssfSeconds SecondsSinceEpoch () const
 Return the current Epoch Return the time since epoch.
ssfTime operator+ (const int &rhsSeconds) const
 Add specified number of seconds to the current time and return a new object.
ssfTime operator+= (const int &rhsSeconds)
 Add specified number of seconds to the current time.
ssfTime operator+ (const long &rhsSeconds) const
 Add specified number of seconds to the current time and return a new object.
ssfTime operator+= (const long &rhsSeconds)
 Add specified number of seconds to the current time.
ssfTime operator+ (const ssfSeconds &rhsSeconds) const
 Add specified number of seconds to the current time and return a new object.
ssfTime operator+= (const ssfSeconds &rhsSeconds)
 Add specified number of seconds to the current time.
ssfSeconds operator- (const ssfTime &rhs) const
 Subtract two time objects (the stored times).
bool operator> (const ssfTime &rhs) const
 Greater than comparison two time objects (the stored times).
bool operator>= (const ssfTime &rhs) const
 Greater than or equal comparison two time objects (the stored times).
bool operator< (const ssfTime &rhs) const
 Less than comparison two time objects (the stored times).
bool operator<= (const ssfTime &rhs) const
 Less than or equal comparison two time objects (the stored times).
bool operator== (const ssfTime &rhs) const
 Compare the equality of two time objects (the stored times).
bool operator!= (const ssfTime &rhs) const
 Compare the inequality of two time objects (the stored times).

Private Attributes

ssfSeconds m_StoredTime
ssfSeconds m_EpochTime

Friends

std::ostream & operator<< (std::ostream &s, ssfTime &t)
 output the time in seconds format

Related Functions

(Note that these are not member functions.)

ssfJulianDate JulianDate (const ssfSeconds &_time)
 Calculates the Julian Date given a time in seconds since the system epoch.


Constructor & Destructor Documentation

O_SESSAME::ssfTime::ssfTime  )  [inline]
 

Default constructor. Initializes the time to 0 seconds.

Definition at line 79 of file Time.h.

References O_SESSAME::ssfSeconds.

O_SESSAME::ssfTime::ssfTime tm  _Time  )  [inline]
 

Constructor creates a time object as a copy of a time struct.

Parameters:
_Time tm struct to be copied as the time object.

Definition at line 84 of file Time.h.

O_SESSAME::ssfTime::ssfTime timeval  _Time  )  [inline]
 

Constructor creates a time object as a copy of a timeval struct.

struct timeval { long tv_sec; // seconds long tv_usec; // and microseconds };

Parameters:
_Time timeval struct to be copied as the time object.

Definition at line 95 of file Time.h.

O_SESSAME::ssfTime::ssfTime ssfSeconds  _Time  )  [inline]
 

Constructor creates time object based on number of seconds.

Parameters:
_Time number of seconds to set the time object to.

Definition at line 100 of file Time.h.

O_SESSAME::ssfTime::ssfTime int  year,
int  month,
int  day,
int  hour,
int  minute,
double  seconds
[inline]
 

Constructor creates time object based on a calendar date.

Parameters:
year 4-digit year (must be between 1900-2100)
month numeric month (1-12)
day day of the month (1-31)
hour hour in 24-hour format (0-23)
minute minutes of the hour (0-59)
seconds seconds of the minute (0-59.9999999999)

Definition at line 111 of file Time.h.


Member Function Documentation

tm O_SESSAME::ssfTime::GetDateTime  )  const [inline]
 

Return a tm struct of the date, time of the stored time.

Returns:
tm struct of the date-time tm Struct Definition:
 int tm_sec;     // seconds (0 - 60) 
 int tm_min;     // minutes (0 - 59) 
 int tm_hour;    // hours (0 - 23) 
 int tm_mday;    // day of month (1 - 31) 
 int tm_mon;     // month of year (0 - 11) 
 int tm_year;    // year - 1900 
 int tm_wday;    // day of week (Sunday = 0) 
 int tm_yday;    // day of year (0 - 365) 
 int tm_isdst;   // is summer time in effect? 
 char *tm_zone;  // abbreviation of timezone name 
 long tm_gmtoff; // offset from UTC in seconds 
Example:
 cout << myTime.GetDateTime().tm_mon << "/" << myTime.GetEpochDateTime().tm_mday << "/" << myTime.GetEpochDateTime().tm_year;
Warning:
does not return sub-seconds (rounded to lowest second)

Definition at line 227 of file Time.h.

Referenced by GPSObserver::Run().

ssfSeconds O_SESSAME::ssfTime::GetEpoch  )  const [inline]
 

Return the current Epoch.

Returns:
currently stored epoch time (tm struct)

Definition at line 259 of file Time.h.

References O_SESSAME::ssfSeconds.

tm O_SESSAME::ssfTime::GetEpochDateTime  )  const [inline]
 

Return the epoch in a tm struct of the date-time .

Returns:
tm struct of the date-time.
tm Struct Definition:
 int tm_sec;     // seconds (0 - 60) 
 int tm_min;     // minutes (0 - 59) 
 int tm_hour;    // hours (0 - 23) 
 int tm_mday;    // day of month (1 - 31) 
 int tm_mon;     // month of year (0 - 11) 
 int tm_year;    // year - 1900 
 int tm_wday;    // day of week (Sunday = 0) 
 int tm_yday;    // day of year (0 - 365) 
 int tm_isdst;   // is summer time in effect? 
 char *tm_zone;  // abbreviation of timezone name 
 long tm_gmtoff; // offset from UTC in seconds 
Example:
 cout << myTime.GetEpochDateTime().tm_mon << "/" << myTime.GetEpochDateTime().tm_mday << "/" << myTime.GetEpochDateTime().tm_year;
Warning:
does not return sub-seconds (rounded to lowest second)

Definition at line 253 of file Time.h.

Angle O_SESSAME::ssfTime::GetEpochGreenwichMeanSiderealTime  )  const
 

Get the Julian Date of the time object's epoch.

ref Vallado p.61-63

Warning:
need to change to accept different epochs & account for rotation of central body
Returns:
Greenwich sidereal time of the epoch, measured from epoch in 1970, [rad]

Definition at line 144 of file Time.cpp.

References O_SESSAME::Angle, and GetEpochJulianDate().

Referenced by O_SESSAME::TiltedDipoleMagneticModel::GetMagneticField().

ssfJulianDate O_SESSAME::ssfTime::GetEpochJulianDate  )  const
 

Get the Julian Date of the time object's epoch.

Returns:
This function returns the Epoch in Julian Date format (DETAIL JD OUTPUT)

Definition at line 87 of file Time.cpp.

References JulianDate(), m_EpochTime, and O_SESSAME::ssfJulianDate.

Referenced by GetEpochGreenwichMeanSiderealTime().

Angle O_SESSAME::ssfTime::GetGreenwichMeanSiderealTime  )  const
 

Calculate the Greenwich sidereal time of the stored time.

Returns:
Greenwich sidereal time, measured from epoch in 1970, [rad]

Definition at line 138 of file Time.cpp.

References O_SESSAME::Angle, and GetJulianDate().

ssfJulianDate O_SESSAME::ssfTime::GetJulianDate  )  const
 

Get the Julian Date of the time object.

Returns:
This function returns the Julian Date (DETAIL JD OUTPUT)

Definition at line 69 of file Time.cpp.

References JulianDate(), m_StoredTime, and O_SESSAME::ssfJulianDate.

Referenced by GetGreenwichMeanSiderealTime().

ssfSeconds O_SESSAME::ssfTime::GetSeconds  )  const [inline]
 

Return the current time in seconds.

Returns:
currently stored time (seconds)

Definition at line 202 of file Time.h.

References O_SESSAME::ssfSeconds.

Referenced by AttitudeTrajectory(), O_SESSAME::TiltedDipoleMagneticModel::GetMagneticField(), O_SESSAME::OrbitHistory::GetState(), O_SESSAME::AttitudeHistory::GetState(), slidingModeControlMRPMW::Initialize(), MRPTracking::Initialize(), AngularRateController::Initialize(), O_SESSAME::RungeKuttaIntegrator::Integrate(), main(), operator!=(), operator-(), operator<(), O_SESSAME::operator<<(), operator<=(), operator==(), operator>(), operator>=(), QuaternionEKF(), QuaternionEKFOriginal(), Controller::ReferenceModelSC(), Controller::ReferenceTrajectory(), testOrbitController::Run(), slidingModeControlMRPMW::Run(), OrbitPropObserver::Run(), MRPTracking::Run(), GPSObserver::Run(), COENaaszController::Run(), AngularRateController::Run(), SimpleController(), QuaternionEKFObserver::StateCovarianceUpdate(), QuaternionEKFObserver::StateTransitionMatrix(), testRKFunc(), and testRKFunc2().

bool O_SESSAME::ssfTime::operator!= const ssfTime rhs  )  const [inline]
 

Compare the inequality of two time objects (the stored times).

Parameters:
rhs time object to be compared with.
Returns:
TRUE if the stored times are not equal, FALSE if they are equal.
Todo:
Determine if it needs to compare the Epoch times as well.

Definition at line 392 of file Time.h.

References GetSeconds().

ssfTime O_SESSAME::ssfTime::operator+ const ssfSeconds rhsSeconds  )  const [inline]
 

Add specified number of seconds to the current time and return a new object.

Parameters:
rhsSeconds Number of seconds to be added.
Returns:
new Time object whose current time is equal to the original time plus rhsSeconds.

Definition at line 334 of file Time.h.

ssfTime O_SESSAME::ssfTime::operator+ const long &  rhsSeconds  )  const [inline]
 

Add specified number of seconds to the current time and return a new object.

Parameters:
rhsSeconds Number of seconds to be added.
Returns:
new Time object whose current time is equal to the original time plus rhsSeconds.

Definition at line 320 of file Time.h.

References operator+().

ssfTime O_SESSAME::ssfTime::operator+ const int &  rhsSeconds  )  const [inline]
 

Add specified number of seconds to the current time and return a new object.

Parameters:
rhsSeconds Number of seconds to be added.
Returns:
new Time object whose current time is equal to the original time plus rhsSeconds.

Definition at line 306 of file Time.h.

References operator+().

ssfTime O_SESSAME::ssfTime::operator+= const ssfSeconds rhsSeconds  )  [inline]
 

Add specified number of seconds to the current time.

Parameters:
rhsSeconds Number of seconds to be added.
Returns:
the same time object with the current time plus rhsSeconds.

Definition at line 341 of file Time.h.

ssfTime O_SESSAME::ssfTime::operator+= const long &  rhsSeconds  )  [inline]
 

Add specified number of seconds to the current time.

Parameters:
rhsSeconds Number of seconds to be added.
Returns:
the same time object with the current time plus rhsSeconds.

Definition at line 327 of file Time.h.

ssfTime O_SESSAME::ssfTime::operator+= const int &  rhsSeconds  )  [inline]
 

Add specified number of seconds to the current time.

Parameters:
rhsSeconds Number of seconds to be added.
Returns:
the same time object with the current time plus rhsSeconds.

Definition at line 313 of file Time.h.

ssfSeconds O_SESSAME::ssfTime::operator- const ssfTime rhs  )  const [inline]
 

Subtract two time objects (the stored times).

Parameters:
rhs time object to be subtracted.
Returns:
new time object that is the difference between the lhs and the rhs.

Definition at line 348 of file Time.h.

References GetSeconds(), and O_SESSAME::ssfSeconds.

bool O_SESSAME::ssfTime::operator< const ssfTime rhs  )  const [inline]
 

Less than comparison two time objects (the stored times).

Parameters:
rhs time object to be compared with.
Returns:
TRUE if the left operand's stored time is less than the right operand's stored time, FALSE if it is not.

Definition at line 369 of file Time.h.

References GetSeconds().

bool O_SESSAME::ssfTime::operator<= const ssfTime rhs  )  const [inline]
 

Less than or equal comparison two time objects (the stored times).

Parameters:
rhs time object to be compared with.
Returns:
TRUE if the left operand's stored time is Less than or equal to the right operand's stored time, FALSE if it is not.

Definition at line 376 of file Time.h.

References GetSeconds().

bool O_SESSAME::ssfTime::operator== const ssfTime rhs  )  const [inline]
 

Compare the equality of two time objects (the stored times).

Parameters:
rhs time object to be compared with.
Returns:
TRUE if the stored times are equal, FALSE if they are not.
Todo:
Determine if it needs to compare the Epoch times as well.

Definition at line 384 of file Time.h.

References GetSeconds().

bool O_SESSAME::ssfTime::operator> const ssfTime rhs  )  const [inline]
 

Greater than comparison two time objects (the stored times).

Parameters:
rhs time object to be compared with.
Returns:
TRUE if the left operand's stored time is greater than the right operand's stored time, FALSE if it is not.

Definition at line 355 of file Time.h.

References GetSeconds().

bool O_SESSAME::ssfTime::operator>= const ssfTime rhs  )  const [inline]
 

Greater than or equal comparison two time objects (the stored times).

Parameters:
rhs time object to be compared with.
Returns:
TRUE if the left operand's stored time is greater than or equal to the right operand's stored time, FALSE if it is not.

Definition at line 362 of file Time.h.

References GetSeconds().

ssfSeconds O_SESSAME::ssfTime::SecondsSinceEpoch  )  const [inline]
 

Return the current Epoch Return the time since epoch.

Returns:
the number of seconds that have passed since epoch

Definition at line 299 of file Time.h.

References O_SESSAME::ssfSeconds.

Referenced by O_SESSAME::TiltedDipoleMagneticModel::GetMagneticField().

void O_SESSAME::ssfTime::Set int  year,
int  month,
int  day,
int  hour,
int  minute,
double  seconds
 

Set the ssfTime object based on a calendar date.

Parameters:
year 4-digit year (must be between 1900-2100)
month numeric month (1-12)
day day of the month (1-31)
hour hour in 24-hour format (0-23)
minute minutes of the hour (0-59)
seconds seconds of the minute (0-59.9999999999)

Definition at line 91 of file Time.cpp.

References m_StoredTime, and timegm.

void O_SESSAME::ssfTime::Set ssfSeconds  _newTime  )  [inline]
 

Set the ssfTime object to a specified time in seconds.

Parameters:
_newTime the time to store

Definition at line 136 of file Time.h.

void O_SESSAME::ssfTime::Set timeval  _Time  )  [inline]
 

Set the time object as a copy of a timeval struct.

struct timeval { long tv_sec; // seconds long tv_usec; // and microseconds };

Parameters:
_Time timeval struct to set the time object.

Definition at line 129 of file Time.h.

void O_SESSAME::ssfTime::Set tm  _newTime  )  [inline]
 

Set the ssfTime object to a specified time struct.

Parameters:
_newTime the time to store in a tm struct

Definition at line 117 of file Time.h.

References timegm.

Referenced by O_SESSAME::TiltedDipoleMagneticModel::GetMagneticField(), and O_SESSAME::tick().

void O_SESSAME::ssfTime::SetEpoch int  year,
int  month,
int  day,
int  hour,
int  minute,
double  seconds
 

Set the epoch of the ssfTime object based on a calendar date.

Parameters:
year 4-digit year (must be between 1900-2100)
month numeric month (1-12)
day day of the month (1-31)
hour hour in 24-hour format (0-23)
minute minutes of the hour (0-59)
seconds seconds of the minute (0-59.9999999999)

Definition at line 104 of file Time.cpp.

References m_EpochTime, and timegm.

void O_SESSAME::ssfTime::SetEpoch const timeval &  _Time  )  [inline]
 

Set the epoch time from a timeval struct.

struct timeval { long tv_sec; // seconds long tv_usec; // and microseconds };

Parameters:
_Time timeval struct used to set the Epoch time.

Definition at line 186 of file Time.h.

void O_SESSAME::ssfTime::SetEpoch tm  _newEpochTime  )  [inline]
 

Set the epoch time.

Parameters:
_newEpochTime new Epoch (tm struct)

Definition at line 174 of file Time.h.

References timegm.

void O_SESSAME::ssfTime::SetEpoch ssfSeconds  _newEpochTime  )  [inline]
 

Set the epoch time.

Parameters:
_newEpochTime new Epoch (seconds)

Definition at line 168 of file Time.h.

Referenced by O_SESSAME::EarthCentralBody::EarthCentralBody().

void O_SESSAME::ssfTime::SetEpochJulianDate ssfJulianDate  _newJD  ) 
 

Set the Epoch to a specified Julian Date.

Parameters:
_newJD Julian Date to set.

Definition at line 128 of file Time.cpp.

References JulianDate(), and m_EpochTime.

void O_SESSAME::ssfTime::SetJulianDate ssfJulianDate  _newJD  ) 
 

Set the ssfTime object to a specified Julian Date.

Parameters:
_newJD Julian Date to set.

Definition at line 118 of file Time.cpp.

References JulianDate(), and m_StoredTime.

void O_SESSAME::ssfTime::SetTimeAfterEpoch ssfSeconds  _timeAfter  )  [inline]
 

Set the current time after epoch.

Parameters:
_timeAfter time (in seconds) after epoch

Definition at line 162 of file Time.h.


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &  s,
ssfTime t
[friend]
 

output the time in seconds format

Definition at line 150 of file Time.cpp.


Member Data Documentation

ssfSeconds O_SESSAME::ssfTime::m_EpochTime [private]
 

Internatlly stored Epoch time (seconds)

Definition at line 400 of file Time.h.

Referenced by GetEpochJulianDate(), SetEpoch(), and SetEpochJulianDate().

ssfSeconds O_SESSAME::ssfTime::m_StoredTime [private]
 

Internally stored time (seconds)

Definition at line 399 of file Time.h.

Referenced by GetJulianDate(), Set(), and SetJulianDate().


The documentation for this class was generated from the following files:
Generated on Wed Sep 5 12:54:50 2007 for DSACSS Operational Code by  doxygen 1.3.9.1