Isis 3 Programmer Reference
Isis::iTime Class Reference

Parse and return pieces of a time string. More...

#include <iTime.h>

Collaboration diagram for Isis::iTime:
Collaboration graph

Public Member Functions

 iTime ()
 Constructs an empty iTime object.
 
 iTime (const QString &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.
 
void operator= (const QString &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.
 
iTime operator+ (const double &secondsToAdd) const
 
void operator+= (const double &secondsToAdd)
 
iTime operator- (const double &secondsToSubtract) const
 
double operator- (const iTime &iTimeToSubtract) const
 
void operator-= (const double &secondsToSubtract)
 
QString 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.
 
QString 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.
 
QString 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.
 
QString 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.
 
QString 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.
 
QString SecondString (int precision=8) const
 Returns the second portion of the time as a string.
 
double Second () const
 Returns the second portion of the time as a double.
 
QString 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.
 
QString 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.
 
QString UTC (int precision=8) const
 Returns the internally stored time, formatted as a UTC time.
 
void setEt (double et)
 
void setUtc (QString utcString)
 

Static Public Member Functions

static QString 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 QString 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 LoadLeapSecondKernel ()
 Uses the Naif routines to load the most current leap second kernel.
 

Private Attributes

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
 

Friends

iTime operator+ (const double &secondsToAdd, iTime time)
 
iTime operator- (const double &secondsToSubtract, iTime time)
 

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
History

2003-11-05 Stuart Sides - Fixed error in documentation

2003-12-03 Stuart Sides - Added comparison operators for (>=, <=, >, <, ==, and !=)

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.

2005-02-22 Elizabeth Ribelin - Modified file to support Doxygen documentation

2006-03-31 Elizabeth Miller - added UTC method

2006-10-02 Brendan George - Added CurrentLocalTime and CurrentGMT methods

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

2011-05-25 Janet Barrett and Steven Lambright - Added setUtc, setEt and addition operators

2015-07-21 Kristin Berry - Added NaifStatus::CheckErrors() to see if any NAIF errors were signaled. References #2248.

2018-03-15 Adam Goins - Removed deprecated function iTime::UnloadLeapSecondKernel(). Fixes #5325.

2019-06-15 Kristin Berry - Added a precision option to UTC to specify the precision of the output value. The default (old) precision is used if no argument is specified.

2021-02-17 Jesse Mapel - Added the ability to pass ISO 8601 basic format time strings to setUtc.

Definition at line 65 of file iTime.h.

Constructor & Destructor Documentation

◆ iTime() [1/3]

Isis::iTime::iTime ( )

Constructs an empty iTime object.

Definition at line 32 of file iTime.cpp.

References p_et.

◆ iTime() [2/3]

Isis::iTime::iTime ( const QString & time)

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

Parameters
timeA 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 42 of file iTime.cpp.

References Isis::NaifStatus::CheckErrors(), LoadLeapSecondKernel(), and p_et.

◆ iTime() [3/3]

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

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

Parameters
timeAn ephemeris time (ET).

Definition at line 76 of file iTime.h.

References LoadLeapSecondKernel(), and p_et.

◆ ~iTime()

Isis::iTime::~iTime ( )
inline

Definition at line 84 of file iTime.h.

Member Function Documentation

◆ CurrentGMT()

QString 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
QString The Current GMT

Definition at line 504 of file iTime.cpp.

◆ CurrentLocalTime()

QString 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
QString The cutrrent local time

Definition at line 520 of file iTime.cpp.

Referenced by Isis::JigsawRunWidget::bundleFinished(), Isis::BundleAdjust::errorPropagation(), and Isis::BundleSolutionInfo::outputHeader().

◆ Day()

int Isis::iTime::Day ( ) const

Returns the day portion of the time as an int.

Returns
int

Definition at line 277 of file iTime.cpp.

References Isis::NaifStatus::CheckErrors(), p_et, and Isis::IString::ToInteger().

Referenced by DayString(), and UTC().

◆ DayOfYear()

int Isis::iTime::DayOfYear ( ) const

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

Returns
int

Definition at line 380 of file iTime.cpp.

References Isis::NaifStatus::CheckErrors(), p_et, and Isis::IString::ToInteger().

Referenced by DayOfYearString().

◆ DayOfYearString()

QString Isis::iTime::DayOfYearString ( ) const

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

Returns
string

Definition at line 371 of file iTime.cpp.

References DayOfYear(), and Isis::toString().

◆ DayString()

QString Isis::iTime::DayString ( ) const

Returns the dat portion of the time as a string.

Returns
string

Definition at line 268 of file iTime.cpp.

References Day(), and Isis::toString().

Referenced by UTC().

◆ Et()

◆ EtString()

QString 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 396 of file iTime.cpp.

References p_et, and Isis::toString().

◆ Hour()

int Isis::iTime::Hour ( ) const

Returns the hour portion of the time as an int.

Returns
int

Definition at line 301 of file iTime.cpp.

References Isis::NaifStatus::CheckErrors(), p_et, and Isis::IString::ToInteger().

Referenced by HourString(), and UTC().

◆ HourString()

QString Isis::iTime::HourString ( ) const

Returns the hour portion of the time as a string.

Returns
string

Definition at line 292 of file iTime.cpp.

References Hour(), and Isis::toString().

Referenced by UTC().

◆ LoadLeapSecondKernel()

void Isis::iTime::LoadLeapSecondKernel ( )
private

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

Definition at line 471 of file iTime.cpp.

References Isis::NaifStatus::CheckErrors(), Isis::FileName::expanded(), Isis::FileName::highestVersion(), and Isis::IException::User.

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

◆ Minute()

int Isis::iTime::Minute ( ) const

Returns the minute portion of the time as an int.

Returns
int

Definition at line 325 of file iTime.cpp.

References Isis::NaifStatus::CheckErrors(), p_et, and Isis::IString::ToInteger().

Referenced by MinuteString(), and UTC().

◆ MinuteString()

QString Isis::iTime::MinuteString ( ) const

Returns the minute portion of the time as a string.

Returns
string

Definition at line 316 of file iTime.cpp.

References Minute(), and Isis::toString().

Referenced by UTC().

◆ Month()

int Isis::iTime::Month ( ) const

Returns the month portion of the time as an int.

Returns
int

Definition at line 253 of file iTime.cpp.

References Isis::NaifStatus::CheckErrors(), p_et, and Isis::IString::ToInteger().

Referenced by MonthString(), and UTC().

◆ MonthString()

QString Isis::iTime::MonthString ( ) const

Returns the month portion of the time as a string.

Returns
string

Definition at line 244 of file iTime.cpp.

References Month(), and Isis::toString().

Referenced by UTC().

◆ operator!=()

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

Compare two iTime objects for inequality.

Parameters
timeThe iTime object to be compared to "this"
Returns
bool

Definition at line 150 of file iTime.cpp.

References p_et.

◆ operator+()

iTime Isis::iTime::operator+ ( const double & secondsToAdd) const

Definition at line 166 of file iTime.cpp.

◆ operator+=()

void Isis::iTime::operator+= ( const double & secondsToAdd)

Definition at line 173 of file iTime.cpp.

◆ operator-() [1/2]

iTime Isis::iTime::operator- ( const double & secondsToSubtract) const

Definition at line 187 of file iTime.cpp.

◆ operator-() [2/2]

double Isis::iTime::operator- ( const iTime & iTimeToSubtract) const

Definition at line 194 of file iTime.cpp.

◆ operator-=()

void Isis::iTime::operator-= ( const double & secondsToSubtract)

Definition at line 199 of file iTime.cpp.

◆ operator<()

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

Compare two iTime objects for less than.

Parameters
timeThe iTime object to be compared to "this"
Returns
bool

Definition at line 139 of file iTime.cpp.

References p_et.

◆ operator<=()

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

Compare two iTime objects for less than or equal.

Parameters
timeThe iTime object to be compared to "this"
Returns
bool

Definition at line 116 of file iTime.cpp.

References p_et.

◆ operator=() [1/3]

void Isis::iTime::operator= ( const char * time)

Definition at line 79 of file iTime.cpp.

◆ operator=() [2/3]

void Isis::iTime::operator= ( const double time)

Definition at line 93 of file iTime.cpp.

◆ operator=() [3/3]

void Isis::iTime::operator= ( const QString & time)

Changes the value of the iTime object.

Parameters
timeA 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 66 of file iTime.cpp.

References Isis::NaifStatus::CheckErrors(), LoadLeapSecondKernel(), and p_et.

◆ operator==()

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

Compare two iTime objects for equality.

Parameters
timeThe iTime object to be compared to "this"
Returns
bool

Definition at line 161 of file iTime.cpp.

References p_et.

◆ operator>()

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

Compare two iTime objects for greater than.

Parameters
timeThe iTime object to be compared to "this"
Returns
bool

Definition at line 127 of file iTime.cpp.

References p_et.

◆ operator>=()

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

Compare two iTime objects for greater than or equal.

Parameters
timeThe iTime object to be compared to "this"
Returns
bool

Definition at line 105 of file iTime.cpp.

References p_et.

◆ Second()

double Isis::iTime::Second ( ) const

Returns the second portion of the time as a double.

Returns
double

Definition at line 356 of file iTime.cpp.

References Isis::NaifStatus::CheckErrors(), p_et, and Isis::IString::ToDouble().

Referenced by SecondString(), and UTC().

◆ SecondString()

QString Isis::iTime::SecondString ( int precision = 8) const

Returns the second portion of the time as a string.

Returns
string

Definition at line 340 of file iTime.cpp.

References Second().

Referenced by UTC().

◆ setEt()

void Isis::iTime::setEt ( double et)

Definition at line 425 of file iTime.cpp.

◆ setUtc()

void Isis::iTime::setUtc ( QString utcString)

Definition at line 432 of file iTime.cpp.

◆ UTC()

QString Isis::iTime::UTC ( int precision = 8) const

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

Returns
string The internalized time, in UTC format

Definition at line 405 of file iTime.cpp.

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

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

◆ Year()

int Isis::iTime::Year ( ) const

Returns the year portion of the time as an int.

Returns
int

Definition at line 229 of file iTime.cpp.

References Isis::NaifStatus::CheckErrors(), p_et, and Isis::IString::ToInteger().

Referenced by YearString().

◆ YearString()

QString Isis::iTime::YearString ( ) const

Returns the year portion of the time as a string.

Returns
string

Definition at line 220 of file iTime.cpp.

References Isis::toString(), and Year().

Referenced by UTC().

Friends And Related Symbol Documentation

◆ operator+

iTime operator+ ( const double & secondsToAdd,
iTime time )
friend

Definition at line 179 of file iTime.cpp.

◆ operator-

iTime operator- ( const double & secondsToSubtract,
iTime time )
friend

Definition at line 205 of file iTime.cpp.

Member Data Documentation

◆ p_et

double Isis::iTime::p_et
private

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

Definition at line 138 of file iTime.h.

Referenced by Day(), DayOfYear(), Et(), EtString(), Hour(), iTime(), iTime(), iTime(), Minute(), Month(), operator!=(), operator<(), operator<=(), operator=(), operator==(), operator>(), operator>=(), Second(), and Year().

◆ p_lpInitialized

bool Isis::iTime::p_lpInitialized = false
staticprivate

Definition at line 143 of file iTime.h.


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