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 61 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

ostream & operator<< (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  ) 
 

Default constructor. Initializes the time to 0 seconds.

Definition at line 65 of file Time.h.

O_SESSAME::ssfTime::ssfTime tm  _Time  ) 
 

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 70 of file Time.h.

O_SESSAME::ssfTime::ssfTime timeval  _Time  ) 
 

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 81 of file Time.h.

O_SESSAME::ssfTime::ssfTime ssfSeconds  _Time  ) 
 

Constructor creates time object based on number of seconds.

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

Definition at line 86 of file Time.h.

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

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 97 of file Time.h.


Member Function Documentation

void O_SESSAME::ssfTime::Set tm  _newTime  ) 
 

Set the ssfTime object to a specified time struct.

Parameters:
_newTime the time to store in a tm struct

Definition at line 103 of file Time.h.

void O_SESSAME::ssfTime::Set timeval  _Time  ) 
 

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 115 of file Time.h.

void O_SESSAME::ssfTime::Set ssfSeconds  _newTime  ) 
 

Set the ssfTime object to a specified time in seconds.

Parameters:
_newTime the time to store

Definition at line 122 of file Time.h.

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 117 of file Time.cpp.

void O_SESSAME::ssfTime::SetEpochJulianDate ssfJulianDate  _newJD  ) 
 

Set the Epoch to a specified Julian Date.

Parameters:
_newJD Julian Date to set.

Definition at line 127 of file Time.cpp.

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 90 of file Time.cpp.

void O_SESSAME::ssfTime::SetTimeAfterEpoch ssfSeconds  _timeAfter  ) 
 

Set the current time after epoch.

Parameters:
_timeAfter time (in seconds) after epoch

Definition at line 148 of file Time.h.

void O_SESSAME::ssfTime::SetEpoch ssfSeconds  _newEpochTime  ) 
 

Set the epoch time.

Parameters:
_newEpochTime new Epoch (seconds)

Definition at line 154 of file Time.h.

void O_SESSAME::ssfTime::SetEpoch tm  _newEpochTime  ) 
 

Set the epoch time.

Parameters:
_newEpochTime new Epoch (tm struct)

Definition at line 160 of file Time.h.

void O_SESSAME::ssfTime::SetEpoch const timeval &  _Time  ) 
 

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 172 of file Time.h.

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 103 of file Time.cpp.

ssfSeconds O_SESSAME::ssfTime::GetSeconds  )  const
 

Return the current time in seconds.

Returns:
currently stored time (seconds)

Definition at line 188 of file Time.h.

tm O_SESSAME::ssfTime::GetDateTime  )  const
 

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 213 of file Time.h.

tm O_SESSAME::ssfTime::GetEpochDateTime  )  const
 

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 239 of file Time.h.

ssfSeconds O_SESSAME::ssfTime::GetEpoch  )  const
 

Return the current Epoch.

Returns:
currently stored epoch time (tm struct)

Definition at line 245 of file Time.h.

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 68 of file Time.cpp.

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 86 of file Time.cpp.

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 137 of file Time.cpp.

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 143 of file Time.cpp.

ssfSeconds O_SESSAME::ssfTime::SecondsSinceEpoch  )  const
 

Return the current Epoch Return the time since epoch.

Returns:
the number of seconds that have passed since epoch

Definition at line 285 of file Time.h.

ssfTime O_SESSAME::ssfTime::operator+ const int &  rhsSeconds  )  const
 

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 292 of file Time.h.

ssfTime O_SESSAME::ssfTime::operator+= const int &  rhsSeconds  ) 
 

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 299 of file Time.h.

ssfTime O_SESSAME::ssfTime::operator+ const long &  rhsSeconds  )  const
 

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.

ssfTime O_SESSAME::ssfTime::operator+= const long &  rhsSeconds  ) 
 

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.

ssfTime O_SESSAME::ssfTime::operator+ const ssfSeconds rhsSeconds  )  const
 

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.

ssfTime O_SESSAME::ssfTime::operator+= const ssfSeconds rhsSeconds  ) 
 

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.

ssfSeconds O_SESSAME::ssfTime::operator- const ssfTime &  rhs  )  const
 

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 334 of file Time.h.

bool O_SESSAME::ssfTime::operator> const ssfTime &  rhs  )  const
 

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 341 of file Time.h.

bool O_SESSAME::ssfTime::operator>= const ssfTime &  rhs  )  const
 

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 348 of file Time.h.

bool O_SESSAME::ssfTime::operator< const ssfTime &  rhs  )  const
 

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 355 of file Time.h.

bool O_SESSAME::ssfTime::operator<= const ssfTime &  rhs  )  const
 

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 362 of file Time.h.

bool O_SESSAME::ssfTime::operator== const ssfTime &  rhs  )  const
 

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 370 of file Time.h.

bool O_SESSAME::ssfTime::operator!= const ssfTime &  rhs  )  const
 

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 378 of file Time.h.


Friends And Related Function Documentation

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

output the time in seconds format

Definition at line 149 of file Time.cpp.


Member Data Documentation

ssfSeconds O_SESSAME::ssfTime::m_StoredTime [private]
 

Internally stored time (seconds)

Definition at line 385 of file Time.h.

ssfSeconds O_SESSAME::ssfTime::m_EpochTime [private]
 

Internatlly stored Epoch time (seconds)

Definition at line 386 of file Time.h.


Generated on Wed Aug 6 12:59:34 2003 for Open-Sessame Framework by doxygen1.3