USGS

Isis 3.0 Object Programmers' Reference

Home

Isis::iTime Class Reference
[Parsing]

#include <iTime.h>

Collaboration diagram for Isis::iTime:

Collaboration graph
[legend]
List of all members.

Detailed Description

Parse and return pieces of a time string.

This class parses a date/time string into individual components. The input time string can be in a variety of formats (see the NAIF routine str2et_c). The components and different representation can then be returned using the member functions.

Author:
2003-10-24 Stuart Sides

For internal use only.

History:
2003-11-05 Stuart Sides - Fixed error in documentation
History:
2003-12-03 Stuart Sides - Added comparison operators for (>=, <=, >, <, ==, and !=)
History:
2003-12-09 Stuart Sides - Modified so all iTime objects will share the same leap second kernel. This means the leapsecond kernel will be loaded once and never unloaded. Other objects which use the leapsecond kernel should not unload it either.
History:
2005-02-22 Elizabeth Ribelin - Modified file to support Doxygen documentation
History:
2006-03-31 Elizabeth Miller - added UTC method
History:
2006-10-02 Brendan George - Added CurrentLocalTime and CurrentGMT methods
History:
2007-12-07 Kris Becker - Modifed the SecondString() method to always return fixed notation for fractions of a second of no more than 8 digits after the decimal point. It was returning scientific notation causing parsing errors (in NAIF, PostgreSQL TIMESTAMP fields, etc...)
Todo:
2005-02-22 Stuart Sides - add coded and implementation examples to class documentation

Definition at line 70 of file iTime.h.

Public Member Functions

 iTime ()
 Constructs an empty iTime object.
 iTime (const std::string &time)
 Constructs a iTime object and initializes it to the time from the argument.
 iTime (const double time)
 Constructs a iTime object and initializes it to the time from the argument.
 ~iTime ()
 Destroys the iTime object.
void operator= (const std::string &time)
 Changes the value of the iTime object.
void operator= (const char *time)
void operator= (const double time)
bool operator>= (const iTime &time)
 Compare two iTime objects for greater than or equal.
bool operator<= (const iTime &time)
 Compare two iTime objects for less than or equal.
bool operator> (const iTime &time)
 Compare two iTime objects for greater than.
bool operator< (const iTime &time)
 Compare two iTime objects for less than.
bool operator!= (const iTime &time)
 Compare two iTime objects for inequality.
bool operator== (const iTime &time)
 Compare two iTime objects for equality.
std::string YearString () const
 Returns the year portion of the time as a string.
int Year () const
 Returns the year portion of the time as an int.
std::string MonthString () const
 Returns the month portion of the time as a string.
int Month () const
 Returns the month portion of the time as an int.
std::string DayString () const
 Returns the dat portion of the time as a string.
int Day () const
 Returns the day portion of the time as an int.
std::string HourString () const
 Returns the hour portion of the time as a string.
int Hour () const
 Returns the hour portion of the time as an int.
std::string MinuteString () const
 Returns the minute portion of the time as a string.
int Minute () const
 Returns the minute portion of the time as an int.
std::string SecondString () const
 Returns the second portion of the time as a string.
double Second () const
 Returns the second portion of the time as a double.
std::string DayOfYearString () const
 Returns the day of year portion of the time as a string.
int DayOfYear () const
 Returns the day of year portion of the time as an int.
std::string EtString () const
 Returns the ephemeris time (TDB) representation of the time as a string.
double Et () const
 Returns the ephemeris time (TDB) representation of the time as a double.
std::string UTC () const
 Returns the internally stored time, formatted as a UTC time.

Static Public Member Functions

static std::string CurrentGMT ()
 Returns the current Greenwich Mean iTime The time is based on the system time, so it is only as accurate as the local system clock.
static std::string CurrentLocalTime ()
 Returns the current local time This time is taken directly from the system clock, so if the system clock is off, this will be, too.

Private Member Functions

void Extract ()
 Uses the Naif routines to convert a double ephemeris reresentation of a date/time to its individual components.
void LoadLeapSecondKernel ()
 Uses the Naif routines to load the most current leap second kernel.
void UnloadLeapSecondKernel ()
 Uses the Naif routines to unload the leap second kernel.

Private Attributes

Isis::Filename p_leapSecond
 The filename used to load the leapsecond kernel.
std::string p_original
 The original string passed into the constructor or the operator= member.
int p_year
 The year portion of the original string passed into the constructor or the operator= member.
int p_month
 The month portion of the original string passed into the constructor or the operator= member.
int p_day
 The day portion of the original string passed into the constructor or the operator= member.
int p_dayOfYear
 The day of year portion of the original string passed into the constructor or the operator= member.
int p_hour
 The hour portion of the original string passed into the constructor or the operator= member.
int p_minute
 The minute portion of the original string passed into the constructor or the operator= member.
double p_second
 The seconds portion of the original string passed into the constructor or the operator= member.
double p_et
 The ephemeris representaion of the original string passed into the constructor or the operator= member.

Static Private Attributes

static bool p_lpInitialized = false


Constructor & Destructor Documentation

Isis::iTime::iTime (  ) 

Constructs an empty iTime object.

Definition at line 43 of file iTime.cpp.

References p_original.

Isis::iTime::iTime ( const std::string &  time  ) 

Constructs a iTime object and initializes it to the time from the argument.

Parameters:
time A time string formatted in standard UTC or similar format. Example:"2000/12/31 23:59:01.6789" or "2000-12-31T23:59:01.6789"

Definition at line 53 of file iTime.cpp.

References Extract(), LoadLeapSecondKernel(), p_et, p_original, and UnloadLeapSecondKernel().

Isis::iTime::iTime ( const double  time  ) 

Constructs a iTime object and initializes it to the time from the argument.

Parameters:
time An ephemeris time (ET).

Definition at line 72 of file iTime.cpp.

References EtString(), Extract(), LoadLeapSecondKernel(), p_et, p_original, and UnloadLeapSecondKernel().

Isis::iTime::~iTime (  ) 

Destroys the iTime object.

Definition at line 81 of file iTime.cpp.


Member Function Documentation

std::string Isis::iTime::CurrentGMT (  )  [static]

Returns the current Greenwich Mean iTime The time is based on the system time, so it is only as accurate as the local system clock.

Returns:
std::string The Current GMT

Definition at line 472 of file iTime.cpp.

std::string Isis::iTime::CurrentLocalTime (  )  [static]

Returns the current local time This time is taken directly from the system clock, so if the system clock is off, this will be, too.

Returns:
std::string The cutrrent local time

Definition at line 488 of file iTime.cpp.

Referenced by Isis::ControlMeasure::SetDateTime(), and Isis::ControlNet::Write().

int Isis::iTime::Day (  )  const

Returns the day portion of the time as an int.

Returns:
int

Definition at line 255 of file iTime.cpp.

References p_day.

Referenced by UTC().

int Isis::iTime::DayOfYear (  )  const

Returns the day of year portion of the time as an int.

Returns:
int

Definition at line 336 of file iTime.cpp.

References p_dayOfYear.

string Isis::iTime::DayOfYearString (  )  const

Returns the day of year portion of the time as a string.

Returns:
string

Definition at line 326 of file iTime.cpp.

References p_dayOfYear.

string Isis::iTime::DayString (  )  const

Returns the dat portion of the time as a string.

Returns:
string

Definition at line 245 of file iTime.cpp.

References p_day.

Referenced by UTC().

double Isis::iTime::Et (  )  const

Returns the ephemeris time (TDB) representation of the time as a double.

See the Naif documentation "time.req" for more information.

Returns:
double

Definition at line 357 of file iTime.cpp.

References p_et.

string Isis::iTime::EtString (  )  const

Returns the ephemeris time (TDB) representation of the time as a string.

See the Naif documentation "time.req" for more information.

Returns:
string

Definition at line 346 of file iTime.cpp.

References p_et.

Referenced by iTime(), and operator=().

void Isis::iTime::Extract (  )  [private]

Uses the Naif routines to convert a double ephemeris reresentation of a date/time to its individual components.

Definition at line 394 of file iTime.cpp.

References p_day, p_dayOfYear, p_et, p_hour, p_minute, p_month, p_second, p_year, Isis::iString::ToDouble(), and Isis::iString::ToInteger().

Referenced by iTime(), and operator=().

int Isis::iTime::Hour (  )  const

Returns the hour portion of the time as an int.

Returns:
int

Definition at line 274 of file iTime.cpp.

References p_hour.

Referenced by UTC().

string Isis::iTime::HourString (  )  const

Returns the hour portion of the time as a string.

Returns:
string

Definition at line 264 of file iTime.cpp.

References p_hour.

Referenced by UTC().

void Isis::iTime::LoadLeapSecondKernel (  )  [private]

Uses the Naif routines to load the most current leap second kernel.

Definition at line 438 of file iTime.cpp.

References Isis::Filename::Expanded(), Isis::PvlObject::FindGroup(), Isis::Filename::HighestVersion(), p_leapSecond, p_lpInitialized, and Isis::Preference::Preferences().

Referenced by iTime(), and operator=().

int Isis::iTime::Minute (  )  const

Returns the minute portion of the time as an int.

Returns:
int

Definition at line 293 of file iTime.cpp.

References p_minute.

Referenced by UTC().

string Isis::iTime::MinuteString (  )  const

Returns the minute portion of the time as a string.

Returns:
string

Definition at line 283 of file iTime.cpp.

References p_minute.

Referenced by UTC().

int Isis::iTime::Month (  )  const

Returns the month portion of the time as an int.

Returns:
int

Definition at line 236 of file iTime.cpp.

References p_month.

Referenced by UTC().

string Isis::iTime::MonthString (  )  const

Returns the month portion of the time as a string.

Returns:
string

Definition at line 226 of file iTime.cpp.

References p_month.

Referenced by UTC().

bool Isis::iTime::operator!= ( const iTime time  ) 

Compare two iTime objects for inequality.

Parameters:
time The iTime object to be compared to "this"
Returns:
bool

Definition at line 187 of file iTime.cpp.

References p_et.

bool Isis::iTime::operator< ( const iTime time  ) 

Compare two iTime objects for less than.

Parameters:
time The iTime object to be compared to "this"
Returns:
bool

Definition at line 176 of file iTime.cpp.

References p_et.

bool Isis::iTime::operator<= ( const iTime time  ) 

Compare two iTime objects for less than or equal.

Parameters:
time The iTime object to be compared to "this"
Returns:
bool

Definition at line 153 of file iTime.cpp.

References p_et.

void Isis::iTime::operator= ( const std::string &  time  ) 

Changes the value of the iTime object.

Parameters:
time A time string formatted in standard UTC or similar format. Example:"2000/12/31 23:59:01.6789" or "2000-12-31T23:59:01.6789"

Definition at line 94 of file iTime.cpp.

References Extract(), LoadLeapSecondKernel(), p_et, p_original, and UnloadLeapSecondKernel().

bool Isis::iTime::operator== ( const iTime time  ) 

Compare two iTime objects for equality.

Parameters:
time The iTime object to be compared to "this"
Returns:
bool

Definition at line 198 of file iTime.cpp.

References p_et.

bool Isis::iTime::operator> ( const iTime time  ) 

Compare two iTime objects for greater than.

Parameters:
time The iTime object to be compared to "this"
Returns:
bool

Definition at line 164 of file iTime.cpp.

References p_et.

bool Isis::iTime::operator>= ( const iTime time  ) 

Compare two iTime objects for greater than or equal.

Parameters:
time The iTime object to be compared to "this"
Returns:
bool

Definition at line 142 of file iTime.cpp.

References p_et.

double Isis::iTime::Second (  )  const

Returns the second portion of the time as a double.

Returns:
double

Definition at line 317 of file iTime.cpp.

References p_second.

Referenced by UTC().

string Isis::iTime::SecondString (  )  const

Returns the second portion of the time as a string.

Returns:
string

Definition at line 302 of file iTime.cpp.

References p_second.

Referenced by UTC().

void Isis::iTime::UnloadLeapSecondKernel (  )  [private]

Uses the Naif routines to unload the leap second kernel.

Definition at line 457 of file iTime.cpp.

Referenced by iTime(), and operator=().

string Isis::iTime::UTC (  )  const

Returns the internally stored time, formatted as a UTC time.

Returns:
string The internalized time, in UTC format

Definition at line 366 of file iTime.cpp.

References Day(), DayString(), Hour(), HourString(), Minute(), MinuteString(), Month(), MonthString(), Second(), SecondString(), and YearString().

Referenced by Qisis::AdvancedTrackTool::updateRow().

int Isis::iTime::Year (  )  const

Returns the year portion of the time as an int.

Returns:
int

Definition at line 217 of file iTime.cpp.

References p_year.

string Isis::iTime::YearString (  )  const

Returns the year portion of the time as a string.

Returns:
string

Definition at line 207 of file iTime.cpp.

References p_year.

Referenced by UTC().


Member Data Documentation

int Isis::iTime::p_day [private]

The day portion of the original string passed into the constructor or the operator= member.

Definition at line 84 of file iTime.h.

Referenced by Day(), DayString(), and Extract().

int Isis::iTime::p_dayOfYear [private]

The day of year portion of the original string passed into the constructor or the operator= member.

Definition at line 86 of file iTime.h.

Referenced by DayOfYear(), DayOfYearString(), and Extract().

double Isis::iTime::p_et [private]

The ephemeris representaion of the original string passed into the constructor or the operator= member.

Definition at line 94 of file iTime.h.

Referenced by Et(), EtString(), Extract(), iTime(), operator!=(), operator<(), operator<=(), operator=(), operator==(), operator>(), and operator>=().

int Isis::iTime::p_hour [private]

The hour portion of the original string passed into the constructor or the operator= member.

Definition at line 88 of file iTime.h.

Referenced by Extract(), Hour(), and HourString().

Isis::Filename Isis::iTime::p_leapSecond [private]

The filename used to load the leapsecond kernel.

Definition at line 72 of file iTime.h.

Referenced by LoadLeapSecondKernel().

int Isis::iTime::p_minute [private]

The minute portion of the original string passed into the constructor or the operator= member.

Definition at line 90 of file iTime.h.

Referenced by Extract(), Minute(), and MinuteString().

int Isis::iTime::p_month [private]

The month portion of the original string passed into the constructor or the operator= member.

Definition at line 82 of file iTime.h.

Referenced by Extract(), Month(), and MonthString().

std::string Isis::iTime::p_original [private]

The original string passed into the constructor or the operator= member.

Or, the string representation of the ephemeris time if the double constructor or operator= was used.

Definition at line 74 of file iTime.h.

Referenced by iTime(), and operator=().

double Isis::iTime::p_second [private]

The seconds portion of the original string passed into the constructor or the operator= member.

Definition at line 92 of file iTime.h.

Referenced by Extract(), Second(), and SecondString().

int Isis::iTime::p_year [private]

The year portion of the original string passed into the constructor or the operator= member.

Definition at line 80 of file iTime.h.

Referenced by Extract(), Year(), and YearString().


The documentation for this class was generated from the following files: