UnixTime Class Reference

#include <UnixTime.hpp>

Inheritance diagram for UnixTime:

Inheritance graph
[legend]
Collaboration diagram for UnixTime:

Collaboration graph
[legend]
List of all members.

Detailed Description

This class encapsulates the "Unix Timeval" time representation.

Definition at line 48 of file UnixTime.hpp.

Public Member Functions

 UnixTime (int sec=0, int usec=0) throw ()
 Default Constructor.
 UnixTime (struct timeval t) throw ()
 struct timeval Constructor.
 UnixTime (const UnixTime &right) throw ()
 Copy Constructor.
 UnixTime (const TimeTag &right) throw ( gpstk::InvalidRequest )
 Alternate Copy Constructor.
 UnixTime (const CommonTime &right) throw ( InvalidRequest )
 Alternate Copy Constructor.
UnixTimeoperator= (const UnixTime &right) throw ()
 Assignment Operator.
virtual ~UnixTime () throw ()
 Virtual Destructor.
virtual CommonTime convertToCommonTime () const throw ( InvalidRequest )
 
Exceptions:
InvalidRequest if this TimeTag cannot be correctly represented by a CommonTime object.

virtual void convertFromCommonTime (const CommonTime &ct) throw ( InvalidRequest )
virtual std::string printf (const std::string &fmt) const throw ( gpstk::StringUtils::StringException )
 This function formats this time to a string.
virtual std::string printError (const std::string &fmt) const throw ( gpstk::StringUtils::StringException )
 This function works similarly to printf.
virtual bool setFromInfo (const IdToValue &info) throw ()
 Set this object using the information provided in info.
virtual std::string getPrintChars () const throw ()
 Return a string containing the characters that this class understands when printing times.
virtual std::string getDefaultFormat () const throw ()
 Return a string containing the default format to use in printing.
virtual bool isValid () const throw ()
 Returns true if this object's members are valid, false otherwise.
virtual void reset () throw ()
 Reset this object to the default state.
virtual bool operator== (const UnixTime &right) const throw ()
virtual bool operator!= (const UnixTime &right) const throw ()
virtual bool operator< (const UnixTime &right) const throw ()
virtual bool operator> (const UnixTime &right) const throw ()
virtual bool operator<= (const UnixTime &right) const throw ()
virtual bool operator>= (const UnixTime &right) const throw ()

Public Attributes

timeval tv


Member Function Documentation

void convertFromCommonTime const CommonTime ct  )  throw ( InvalidRequest ) [virtual]
 

This is the earliest CommonTime for which UnixTimes are valid.

This is the latest CommonTime for which UnixTimes are valid. (2^31 - 1) s and 999999 us

Implements TimeTag.

Definition at line 56 of file UnixTime.cpp.

References GPSTK_THROW, gpstk::MJD_JDAY, and gpstk::SEC_PER_DAY.

Referenced by UnixTime::isValid().

CommonTime convertToCommonTime  )  const throw ( InvalidRequest ) [virtual]
 

Exceptions:
InvalidRequest if this TimeTag cannot be correctly represented by a CommonTime object.

Implements TimeTag.

Definition at line 40 of file UnixTime.cpp.

References GPSTK_THROW, gpstk::MJD_JDAY, gpstk::SEC_PER_DAY, UnixTime::tv, and gpstk::UNIX_MJD.

Referenced by UnixTime::isValid(), gpstk::mixedScanTime(), and gpstk::scanTime().

virtual std::string getDefaultFormat  )  const throw () [inline, virtual]
 

Return a string containing the default format to use in printing.

Implements TimeTag.

Definition at line 161 of file UnixTime.hpp.

virtual std::string getPrintChars  )  const throw () [inline, virtual]
 

Return a string containing the characters that this class understands when printing times.

Implements TimeTag.

Definition at line 154 of file UnixTime.hpp.

bool isValid  )  const throw () [virtual]
 

Returns true if this object's members are valid, false otherwise.

Implements TimeTag.

Definition at line 153 of file UnixTime.cpp.

References UnixTime::convertFromCommonTime(), and UnixTime::convertToCommonTime().

std::string printError const std::string &  fmt  )  const throw ( gpstk::StringUtils::StringException ) [virtual]
 

This function works similarly to printf.

Instead of filling the format with data, it fills with error messages.

Implements TimeTag.

Definition at line 107 of file UnixTime.cpp.

References gpstk::StringUtils::formattedPrint(), and GPSTK_RETHROW.

std::string printf const std::string &  fmt  )  const throw ( gpstk::StringUtils::StringException ) [virtual]
 

This function formats this time to a string.

The exceptions thrown would only be due to problems parsing the fmt string.

Implements TimeTag.

Definition at line 87 of file UnixTime.cpp.

References gpstk::StringUtils::formattedPrint(), and GPSTK_RETHROW.

void reset  )  throw () [virtual]
 

Reset this object to the default state.

Implements TimeTag.

Definition at line 165 of file UnixTime.cpp.

References UnixTime::tv.

bool setFromInfo const IdToValue info  )  throw () [virtual]
 

Set this object using the information provided in info.

Parameters:
info the IdToValue object to which this object shall be set.
Returns:
true if this object was successfully set using the data in info, false if not.

Implements TimeTag.

Definition at line 127 of file UnixTime.cpp.

References gpstk::StringUtils::asInt().

Referenced by gpstk::mixedScanTime(), and gpstk::scanTime().


Member Data Documentation

struct timeval tv
 

Definition at line 195 of file UnixTime.hpp.

Referenced by UnixTime::convertToCommonTime(), and UnixTime::reset().


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