rllib
1
|
#include <rltime_v2.h>
Public Member Functions | |
rlTime (int Year=0, int Month=0, int Day=0, int Hour=0, int Minute=0, int Second=0, int Millisecond=0) | |
virtual | ~rlTime () |
const char * | version () |
const char * | getTimeString () |
const char * | getIsoTimeString () |
const char * | toString (const char *format) |
void | getLocalTime () |
int | getFileModificationTime (const char *filename) |
void | setTimeFromString (const char *time_string) |
void | setTimeFromIsoString (const char *iso_time_string) |
void | setTimeFromSeconds (double const seconds) |
void | setLocalTime () |
double | secondsSinceEpoche () const |
double | seconds () const |
rlTime & | operator+= (const rlTime &time) |
rlTime & | operator-= (const rlTime &time) |
rlTime | operator+ (const rlTime &time) const |
rlTime | operator- (const rlTime &time) const |
rlTime & | operator+= (double seconds) |
rlTime & | operator-= (double seconds) |
rlTime | operator+ (double seconds) const |
rlTime | operator- (double seconds) const |
rlTime & | operator+= (time_t seconds) |
adjust absolute time by number of seconds More... | |
rlTime & | operator-= (time_t seconds) |
adjust absolute time by number of seconds More... | |
rlTime | operator+ (time_t seconds) const |
make new object with absolute time adjusted by number of seconds More... | |
rlTime | operator- (time_t seconds) const |
make new object with absolute time adjusted by number of seconds More... | |
int | operator== (const rlTime &time) const |
int | operator< (const rlTime &time) const |
int | operator<= (const rlTime &time) const |
int | operator> (const rlTime &time) const |
int | operator>= (const rlTime &time) const |
const char * | formatTimeDiffString (double, enum FormatLargestUnit=HoursMinutesSecondsFraction) |
Caller chooses formatting template, default is Hours:Minutes:Seconds.Milliseconds, returned object manages string memory. More... | |
const char * | formatTimeDiffString (const rlTime &t1, const rlTime &t2, enum FormatLargestUnit=HoursMinutesSecondsFraction) |
void | normalizeAsDate () |
Static Public Member Functions | |
static const char * | formatTimeDiff (double, enum FormatLargestUnit=HoursMinutesSecondsFraction, unsigned bufferLength=32, char *buffer=0) |
Caller chooses formatting template, default is Hours:Minutes:Seconds.Milliseconds, caller provides buffer, or buffer must be deleted (delete[]) More... | |
static const char * | formatTimeDiff (const rlTime &t1, const rlTime &t2, enum FormatLargestUnit=HoursMinutesSecondsFraction, unsigned bufferLength=32, char *buffer=0) |
Caller chooses formatting template, default is Hours:Minutes:Seconds.Milliseconds, returned object manages string memory. More... | |
static time_t | timegm (struct tm *tm_) |
Public Attributes | |
int | year |
int | month |
int | day |
int | hour |
int | minute |
int | second |
int | millisecond |
Private Member Functions | |
rlTime (double &) | |
Private Attributes | |
char | time_string [32 *2] |
char | iso_time_string [32] |
class for handling time.
Definition at line 27 of file rltime_v2.h.
Definition at line 92 of file rltime_v2.h.
ns_rltime_v2::rlTime::rlTime | ( | int | Year = 0 , |
int | Month = 0 , |
||
int | Day = 0 , |
||
int | Hour = 0 , |
||
int | Minute = 0 , |
||
int | Second = 0 , |
||
int | Millisecond = 0 |
||
) |
Definition at line 63 of file rltime.cpp.
|
virtual |
Definition at line 74 of file rltime.cpp.
|
explicitprivate |
|
static |
Caller chooses formatting template, default is Hours:Minutes:Seconds.Milliseconds, caller provides buffer, or buffer must be deleted (delete[])
Definition at line 1068 of file rltime_v2.cpp.
|
static |
Caller chooses formatting template, default is Hours:Minutes:Seconds.Milliseconds, returned object manages string memory.
Definition at line 1135 of file rltime_v2.cpp.
const char * ns_rltime_v2::rlTime::formatTimeDiffString | ( | double | tdiff, |
enum FormatLargestUnit | fmt = HoursMinutesSecondsFraction |
||
) |
Caller chooses formatting template, default is Hours:Minutes:Seconds.Milliseconds, returned object manages string memory.
Definition at line 1142 of file rltime_v2.cpp.
const char * ns_rltime_v2::rlTime::formatTimeDiffString | ( | const rlTime & | t1, |
const rlTime & | t2, | ||
enum FormatLargestUnit | fmt = HoursMinutesSecondsFraction |
||
) |
Definition at line 1153 of file rltime_v2.cpp.
int ns_rltime_v2::rlTime::getFileModificationTime | ( | const char * | filename | ) |
Definition at line 164 of file rltime.cpp.
const char * ns_rltime_v2::rlTime::getIsoTimeString | ( | ) |
Definition at line 108 of file rltime.cpp.
void ns_rltime_v2::rlTime::getLocalTime | ( | ) |
Definition at line 114 of file rltime.cpp.
const char * ns_rltime_v2::rlTime::getTimeString | ( | ) |
Definition at line 102 of file rltime.cpp.
void ns_rltime_v2::rlTime::normalizeAsDate | ( | ) |
normalizes odd constructions of time and date, such 2014-03-36 is normalized to 2014-04-05,
Definition at line 98 of file rltime_v2.cpp.
Definition at line 616 of file rltime_v2.cpp.
rlTime ns_rltime_v2::rlTime::operator+ | ( | double | seconds | ) | const |
Definition at line 1001 of file rltime_v2.cpp.
rlTime ns_rltime_v2::rlTime::operator+ | ( | time_t | seconds | ) | const |
make new object with absolute time adjusted by number of seconds
Definition at line 961 of file rltime_v2.cpp.
Definition at line 600 of file rltime_v2.cpp.
rlTime & ns_rltime_v2::rlTime::operator+= | ( | double | seconds | ) |
Definition at line 983 of file rltime_v2.cpp.
rlTime & ns_rltime_v2::rlTime::operator+= | ( | time_t | seconds | ) |
adjust absolute time by number of seconds
Definition at line 876 of file rltime_v2.cpp.
Definition at line 694 of file rltime_v2.cpp.
rlTime ns_rltime_v2::rlTime::operator- | ( | double | seconds | ) | const |
Definition at line 1009 of file rltime_v2.cpp.
rlTime ns_rltime_v2::rlTime::operator- | ( | time_t | seconds | ) | const |
make new object with absolute time adjusted by number of seconds
Definition at line 969 of file rltime_v2.cpp.
Definition at line 608 of file rltime_v2.cpp.
rlTime & ns_rltime_v2::rlTime::operator-= | ( | double | seconds | ) |
Definition at line 992 of file rltime_v2.cpp.
rlTime & ns_rltime_v2::rlTime::operator-= | ( | time_t | seconds | ) |
adjust absolute time by number of seconds
Definition at line 906 of file rltime_v2.cpp.
int ns_rltime_v2::rlTime::operator< | ( | const rlTime & | time | ) | const |
Definition at line 802 of file rltime_v2.cpp.
int ns_rltime_v2::rlTime::operator<= | ( | const rlTime & | time | ) | const |
Definition at line 832 of file rltime_v2.cpp.
int ns_rltime_v2::rlTime::operator== | ( | const rlTime & | time | ) | const |
Definition at line 789 of file rltime_v2.cpp.
int ns_rltime_v2::rlTime::operator> | ( | const rlTime & | time | ) | const |
Definition at line 839 of file rltime_v2.cpp.
int ns_rltime_v2::rlTime::operator>= | ( | const rlTime & | time | ) | const |
Definition at line 869 of file rltime_v2.cpp.
double ns_rltime_v2::rlTime::seconds | ( | ) | const |
seconds := delta time milliseconds within the fraction
Definition at line 1062 of file rltime_v2.cpp.
double ns_rltime_v2::rlTime::secondsSinceEpoche | ( | ) | const |
Definition at line 1028 of file rltime_v2.cpp.
void ns_rltime_v2::rlTime::setLocalTime | ( | ) |
Definition at line 191 of file rltime.cpp.
void ns_rltime_v2::rlTime::setTimeFromIsoString | ( | const char * | iso_time_string | ) |
Definition at line 90 of file rltime.cpp.
void ns_rltime_v2::rlTime::setTimeFromSeconds | ( | double const | seconds | ) |
seconds := delta time milliseconds within the fraction calculating with 1 month <=> 30.5 days
Definition at line 186 of file rltime_v2.cpp.
void ns_rltime_v2::rlTime::setTimeFromString | ( | const char * | time_string | ) |
format: sscanf(time_string,"%d-%d-%d %d:%d:%d %d",&year,&month,&day, &hour,&minute,&second, &millisecond);
Definition at line 78 of file rltime.cpp.
|
static |
emulates the POSIX function, which is i.e. under Windows not available
Definition at line 1017 of file rltime_v2.cpp.
const char * ns_rltime_v2::rlTime::toString | ( | const char * | format | ) |
Returns the datetime as a string. The format parameter determines the format of the result string.
These expressions may be used for the date: Expression Output d the day as number without a leading zero (1 to 31) dd the day as number with a leading zero (01 to 31) M the month as number without a leading zero (1-12) MM the month as number with a leading zero (01-12) MMM the abbreviated localized month name (e.g. 'Jan' to 'Dec'). yy the year as two digit number (00-99) yyyy the year as four digit number
These expressions may be used for the time: Expression Output h the hour without a leading zero (1 to 12 if AM/PM display) hh the hour with a leading zero (01 to 12 if AM/PM display) H the hour without a leading zero (0 to 23, even with AM/PM display) HH the hour with a leading zero (00 to 23, even with AM/PM display) m the minute without a leading zero (0 to 59) mm the minute with a leading zero (00 to 59) s the whole second without a leading zero (0 to 59) ss the whole second with a leading zero where applicable (00 to 59) z the fractional part of the second, to go after a decimal point, without trailing zeroes (0 to 999). zzz the fractional part of the second, to millisecond precision, including trailing zeroes where applicable (000 to 999). AP or A use AM/PM display. A/AP will be replaced by either "AM" or "PM". ap or a use am/pm display. a/ap will be replaced by either "am" or "pm".
All other input characters will be copyed
Example format strings (assumed that the rlTime is 21 May 2001 14:13:09.120): Format Result dd.MM.yyyy 21.05.2001 ddd MMMM d yy Tue May 21 01 hh:mm:ss.zzz 14:13:09.120 hh:mm:ss.z 14:13:09.12 h:m:s ap 2:13:9 pm
Definition at line 265 of file rltime_v2.cpp.
const char * ns_rltime_v2::rlTime::version | ( | ) |
Definition at line 150 of file rltime_v2.cpp.
int ns_rltime_v2::rlTime::day |
Definition at line 86 of file rltime_v2.h.
int ns_rltime_v2::rlTime::hour |
Definition at line 87 of file rltime_v2.h.
|
private |
Definition at line 124 of file rltime_v2.h.
int ns_rltime_v2::rlTime::millisecond |
Definition at line 90 of file rltime_v2.h.
int ns_rltime_v2::rlTime::minute |
Definition at line 88 of file rltime_v2.h.
int ns_rltime_v2::rlTime::month |
Definition at line 85 of file rltime_v2.h.
int ns_rltime_v2::rlTime::second |
Definition at line 89 of file rltime_v2.h.
|
private |
Definition at line 123 of file rltime_v2.h.
int ns_rltime_v2::rlTime::year |
Definition at line 84 of file rltime_v2.h.