vtdata library
|
Public Member Functions | |
void | SetDate (int year, int month, int day) |
void | GetDate (int &year, int &month, int &day) const |
void | SetTimeOfDay (int hr, int min, int sec) |
void | GetTimeOfDay (int &hr, int &min, int &sec) const |
int | GetSecondOfDay () const |
time_t | GetTime () const |
const tm & | GetTM () const |
void | Increment (int secs) |
bool | SetFromString (const vtString &str) |
vtString | GetAsString () |
void | GetSystemTime () |
Protected Member Functions | |
void | _UpdateTM () |
Protected Attributes | |
tm | m_tm |
time_t | m_time |
This class encapsulates time (in increments of whole seconds.)
Time is stored both as a time_t value (integer seconds) and as a tm structure (year, month, day, hour, minute, second). The two values are kept in synch.
Implementation notes: The functions mktime() and localtime() are used to convert between time_t and tm. Although it seems as if this operating on "local" time, it isn't really; it is just a time value. These functions are used because they are the only bidirectional conversion functions exposed by the ANSI C library - the gmtime() function converts time_t to tm more directly, but there is no corresponding method to convert directly from tm to time_t.
void vtTime::SetDate | ( | int | year, |
int | month, | ||
int | day | ||
) |
Set the date components of a vtTime value.
year | E.g. 2001. |
month | in the range of 1 to 12. |
day | in the range of 1 to 31. |