xoreos
0.0.5
|
A date/time object, storing a specific point in time. More...
#include <datetime.h>
Public Types | |
enum | TimeZone { kUTC, kLocal } |
Public Member Functions | |
DateTime (TimeZone zone) | |
Create a DateTime object from the current date and time. More... | |
DateTime (const UString &value) | |
Create a DateTime object by parsing a string representation of a specific date and time. More... | |
uint16 | getYear () const |
Return the year in the Gregorian calendar. More... | |
uint8 | getMonth () const |
Return the month in the Gregorian calendar (1..12). More... | |
uint8 | getDay () const |
Return the day in the Gregorian calendar (1..31). More... | |
uint8 | getHour () const |
Return the hour in the 24-hour clock (0..23). More... | |
uint8 | getMinute () const |
Return the minute (0..59). More... | |
uint8 | getSecond () const |
Return the second (0..60). More... | |
void | getDate (uint16 &year, uint8 &month, uint8 &day) const |
Return the year, month (1..12) and day (1..31) in the Gregorian calendar. More... | |
void | getTime (uint8 &hour, uint8 &minute, uint8 &second) const |
Return the hour in the 24-hour clock (0..23), minute (0..59) and second (0..60). More... | |
void | getDateTime (uint16 &year, uint8 &month, uint8 &day, uint8 &hour, uint8 &minute, uint8 &second) const |
Return the year, month (1..12), day (1..31), hour (0..23), minute (0..59) and second (0..60). More... | |
UString | formatDateISO (uint32 sep=0) const |
Return a string representation of the date in ISO 8601 format. More... | |
UString | formatTimeISO (uint32 sep=0) const |
Return a string representation of the time in ISO 8601 format. More... | |
UString | formatDateTimeISO (uint32 sep=0, uint32 sepDate=0, uint32 sepTime=0) const |
Return a string representation of the date and time in ISO 8601 format. More... | |
A date/time object, storing a specific point in time.
Definition at line 36 of file datetime.h.
Enumerator | |
---|---|
kUTC | Coordinated Universal Time (UTC). |
kLocal | The nondescript local time zone. |
Definition at line 38 of file datetime.h.
Common::DateTime::DateTime | ( | TimeZone | zone | ) |
Create a DateTime object from the current date and time.
zone | The time zone the current date and time should be expressed as. Can be either Coordinated Universal Time (UTC), or the local system time zone. |
Note: The time zone is not stored within the object. It is only used to specify a base for the current time.
Definition at line 35 of file datetime.cpp.
Common::DateTime::DateTime | ( | const UString & | value | ) |
Create a DateTime object by parsing a string representation of a specific date and time.
value | The time value to parse. It has to be in YYYYmmDDTHHMMSS format, or YmdTHMS in strftime() notation, i.e. ISO 8601 format, with the date and the time separated by a 'T', but the individual parts of the date and time not separated at all. |
Definition at line 50 of file datetime.cpp.
References Common::StackException::add(), and Common::UString::c_str().
Return a string representation of the date in ISO 8601 format.
The format will be YYYY-mm-DD, with YYYY being a 4 digit year in the Gregorian calendar, mm being a 2 digit month of the year (01..12) in the Gregorian calendar, DD being a 2 digit day of the month (01..31) in the Gregorian calendar, and - being a freely selectable separator character.
If the separator character is 0, no separator at all is used. The format of the string is then YYYYMMDD.
sep | Use this character as the separator character. |
Definition at line 61 of file datetime.cpp.
References Common::UString::c_str(), and Common::UString::format().
Referenced by formatDateTimeISO().
UString Common::DateTime::formatDateTimeISO | ( | uint32 | sep = 0 , |
uint32 | sepDate = 0 , |
||
uint32 | sepTime = 0 |
||
) | const |
Return a string representation of the date and time in ISO 8601 format.
The format will be YYYY-mm-DDTHH:MM:SS, with T being a freely selectable separator character between the date and the time. For the formatting of the date and time, please see formatDateISO() and formatTimeISO().
If the separator character is 0, no separator at all is used. The format of the string is then YYYY-mm-DDHH:MM:SS.
sep | Use this character as the separator between date and time. |
sepDate | Use this character as the separator between the date elements. |
sepTime | Use this character as the separator between the time elements. |
Definition at line 79 of file datetime.cpp.
References Common::UString::c_str(), Common::UString::format(), formatDateISO(), and formatTimeISO().
Referenced by Graphics::constructFilename(), Common::DebugManager::logString(), Engines::DragonAge::Functions::logTrace(), Engines::DragonAge2::Functions::logTrace(), Engines::DragonAge::Functions::printToLog(), Engines::DragonAge2::Functions::printToLog(), Engines::DragonAge2::Functions::printToLogAndFlush(), Engines::DragonAge::Functions::printToLogAndFlush(), Engines::KotOR2::Functions::writeTimestampedLogEntry(), Engines::NWN::Functions::writeTimestampedLogEntry(), Engines::NWN2::Functions::writeTimestampedLogEntry(), Engines::Witcher::Functions::writeTimestampedLogEntry(), Engines::KotOR::Functions::writeTimestampedLogEntry(), and Engines::Jade::Functions::writeTimestampedLogEntry().
Return a string representation of the time in ISO 8601 format.
The format will be HH:MM:SS, with HH being a 2 digit hour in the 24-hour clock (00..23), MM being a 2 digit minute (00..59), SS being a 2 digit second (00..60, includes a potential leap second), and : being a freely selectable separator character.
If the separator character is 0, no separator at all is used. The format of the string is then HHMMSS.
sep | Use this character as the separator character. |
Definition at line 70 of file datetime.cpp.
References Common::UString::c_str(), and Common::UString::format().
Referenced by formatDateTimeISO().
Return the year, month (1..12) and day (1..31) in the Gregorian calendar.
Definition at line 77 of file datetime.h.
References getDay(), getMonth(), and getYear().
Referenced by getDateTime(), and Common::FoxPro::updateUpdate().
|
inline |
Return the year, month (1..12), day (1..31), hour (0..23), minute (0..59) and second (0..60).
Definition at line 89 of file datetime.h.
References getDate(), and getTime().
|
inline |
Return the day in the Gregorian calendar (1..31).
Definition at line 67 of file datetime.h.
Referenced by getDate().
|
inline |
Return the hour in the 24-hour clock (0..23).
Definition at line 70 of file datetime.h.
Referenced by getTime().
|
inline |
Return the minute (0..59).
Definition at line 72 of file datetime.h.
Referenced by getTime().
|
inline |
Return the month in the Gregorian calendar (1..12).
Definition at line 65 of file datetime.h.
Referenced by getDate().
|
inline |
Return the second (0..60).
Definition at line 74 of file datetime.h.
Referenced by getTime().
Return the hour in the 24-hour clock (0..23), minute (0..59) and second (0..60).
Definition at line 83 of file datetime.h.
References getHour(), getMinute(), and getSecond().
Referenced by getDateTime().
|
inline |
Return the year in the Gregorian calendar.
Definition at line 63 of file datetime.h.
Referenced by getDate().