DateTime Class Reference

Specifies a date and a time. More...

#include <DateTime.h>

List of all members.

Public Member Functions

virtual std::string getFormattedLocal (const std::string &fmt) const =0
virtual std::string getFormattedUtc (const std::string &fmt) const =0
virtual time_t getStructured () const =0
virtual double getSecondsSince (const DateTime &other) const =0
virtual void setToCurrentTime ()=0
virtual void setStructured (time_t val)=0
virtual bool set (unsigned short year, unsigned short month, unsigned short day, unsigned short hour, unsigned short minute, unsigned short second)=0
virtual bool set (unsigned short year=2000, unsigned short month=01, unsigned short day=01)=0
virtual bool set (const std::string &fromTime)=0
virtual bool isTimeValid () const =0
virtual bool isValid () const =0

Protected Member Functions

virtual ~DateTime ()


Detailed Description

Specifies a date and a time.

Base class for date and time object, based upon the capability provided by the standard C library's <time.h>.

Definition at line 24 of file DateTime.h.


Constructor & Destructor Documentation

virtual DateTime::~DateTime (  )  [protected, virtual]

This should be destroyed by calling ObjectFactory::destroyObject.

Definition at line 177 of file DateTime.h.


Member Function Documentation

virtual std::string DateTime::getFormattedLocal ( const std::string &  fmt  )  const [pure virtual]

Gets the time in local coordinates, formatted as a string.

Warning:
This method uses the C library to perform UTC to local time conversions and on some versions of Windows this can incorrectly calculate daylight savings time for historical dates (ie. dates prior to the 2007 Daylight Savings Time switch)
Parameters:
fmt A format specification, consistent with that documented for strftime in <time.h>
Returns:
The contents of this date/time object, formatted as requested by the client into a string.

virtual std::string DateTime::getFormattedUtc ( const std::string &  fmt  )  const [pure virtual]

Gets the time in UTC coordinates, formatted as a string.

Parameters:
fmt A format specification, consistent with that documented for strftime in <time.h>
Returns:
The contents of this date/time object, formatted as requested by the client into a string.

virtual time_t DateTime::getStructured (  )  const [pure virtual]

Gets the time value as a value maniuplated by C.

Returns:
The time_t value that can be passed to traditional C runtime library functions.

virtual double DateTime::getSecondsSince ( const DateTime other  )  const [pure virtual]

Gets the time elapsed between this object and the argument object.

Returns:
The difference, in seconds, between the two date/time values.

virtual void DateTime::setToCurrentTime (  )  [pure virtual]

Resets this object to have the current operating system date and time.

virtual void DateTime::setStructured ( time_t  val  )  [pure virtual]

Sets the time value as a value manipulated by C.

Parameters:
val The time_t value that can be passed to traditional C runtime library functions.

virtual bool DateTime::set ( unsigned short  year,
unsigned short  month,
unsigned short  day,
unsigned short  hour,
unsigned short  minute,
unsigned short  second 
) [pure virtual]

Sets the date and time to explicit client values.

Parameters:
year The four-digit year. Note that years greater than 2047 or less than 1900 are problematical with C.
month Starting from 1 for January, up to 12 for December.
day The day within the month, starting from 1.
hour The hour within the day, from 0 up to 23.
minute The minute within the hour, from 0 to 59.
second The seconds within the minute, from 0 to 59.
Returns:
A boolean indicating if the full set of values was an acceptable date time, including checks for leap years, month-day limits, and so on.

virtual bool DateTime::set ( unsigned short  year = 2000,
unsigned short  month = 01,
unsigned short  day = 01 
) [pure virtual]

Sets the date and time to explicit client values.

Parameters:
year The four-digit year. Note that years greater than 2047 or less than 1900 are problematical with C.
month Starting from 1 for January, up to 12 for December.
day The day within the month, starting from 1.
Returns:
A boolean indicating if the full set of values was an acceptable date time, including checks for leap years, month-day limits, and so on.

virtual bool DateTime::set ( const std::string &  fromTime  )  [pure virtual]

Set the date and time from a specially formatted string.

Parameters:
fromTime A string in a sub-set of ISO8601 format. No validation is performed on this string. This function will also accept strings that omit the time information, ie. from the 'T' onward. The lexical description is: yyyy '-' mm '-' dd 'T' hh ':' MM ':' ss 'Z' where: strings in '' are literal characters yyyy is a four-or-more digit numeral representing the year. 0000 is not valid and this function does not accept negative years even though they are part of ISO8601 mm is a two-digit numeral representing the month dd is a two-digit numeral representing the day hh is a two-digit numeral representing the hour. 24 is permitted if hours and minutes are 00 and 00 MM is a two-digit numeral representing the minute ss is a two-digit numeral representing the whole second
Returns:
true if successfull, false otherwise

virtual bool DateTime::isTimeValid (  )  const [pure virtual]

Queries whether the time component is valid.

The time component of the DateTime object will only be invalid if the date was most recently set with the set method that only takes the date.

Returns:
True if the time component is valid, otherwise false.
See also:
set()

virtual bool DateTime::isValid (  )  const [pure virtual]

Queries whether the DateTime is valid.

Returns:
True if the DateTime is valid, otherwise false.
See also:
set()


Software Development Kit - Opticks 4.9.0 Build 16218