|
EpcTools
An event based multi-threaded C++ development framework.
|
Class for manipulating date and time of day values. More...
#include <etime.h>
Public Member Functions | |
| ETime () | |
| Default constructor. Initializes to current time. More... | |
| ETime (const ETime &a) | |
| Copy constructor. More... | |
| ETime (Int sec, Int usec) | |
| Class constructor. More... | |
| ETime (LongLong ms) | |
| Class constructor. More... | |
| ETime (Int year, Int mon, Int day, Int hour, Int min, Int sec, Bool isLocal) | |
| Class constructor. More... | |
| ~ETime () | |
| Class destructor. More... | |
| ETime & | operator= (const ETime &a) |
| Assignment operator. More... | |
| ETime & | operator= (const timeval &a) |
| Assignment operator. More... | |
| ETime & | operator= (LongLong ms) |
| Assignment operator. More... | |
| Bool | operator== (const ETime &a) |
| Equality operator. More... | |
| Bool | operator!= (const ETime &a) |
| Inequality operator. More... | |
| Bool | operator< (const ETime &a) |
| Less than operator. More... | |
| Bool | operator> (const ETime &a) |
| Greater than operator. More... | |
| Bool | operator>= (const ETime &a) |
| Greater than or equal to operator. More... | |
| Bool | operator<= (const ETime &a) |
| Less than or equal to operator. More... | |
| ETime | operator+ (const ETime &a) |
| Addition operator. More... | |
| ETime | operator+ (const timeval &t) |
| Addition operator. More... | |
| ETime | operator- (const ETime &a) |
| Subtraction operator. More... | |
| ETime | operator- (const timeval &t) |
| Subtraction operator. More... | |
| ETime | add (Int days, Int hrs, Int mins, Int secs, Int usecs) |
| Adds the specified days, hours minutes seconds and microseconds to the current value. More... | |
| ETime | add (const timeval &t) |
| Adds the timeval amount to the current value. More... | |
| ETime | subtract (Int days, Int hrs, Int mins, Int secs, Int usecs) |
| Subtracts the specified days, hours minutes seconds and microseconds to the current value. More... | |
| ETime | subtract (const timeval &t) |
| Subtracts the timeval amount to the current value. More... | |
| const timeval & | getTimeVal () |
| Retrieves a reference to the timeval structure. More... | |
| ETime & | set (const timeval &a) |
| Assigns the specified timeval value to this ETime object. More... | |
| ETime & | set (LongLong ms) |
| Assigns the specified millisecond value to this ETime object. More... | |
| LongLong | getCassandraTimestmap () |
| Converts this ETime value to one compatible with a Cassandra timestamp. More... | |
| Void | getNTPTime (ntp_time_t &ntp) const |
| Retrieves the NTP time representation of this ETime object. More... | |
| Void | setNTPTime (const ntp_time_t &ntp) |
| Assigns the time represented by the NTP time to this ETime object. More... | |
| Bool | isValid () |
| Indicates whether this ETime object is valid or not. More... | |
| Int | year () |
| Retrieves the year. More... | |
| Int | month () |
| Retrieves the month. More... | |
| Int | day () |
| Retrieves the day. More... | |
| Int | hour () |
| Retrieves the hour. More... | |
| Int | minute () |
| Retrieves the minute. More... | |
| Int | second () |
| Retrieves the second. More... | |
| Void | Format (EString &dest, cpStr fmt, Bool local) |
| Formats the date/time value as specified by the format string. More... | |
| Void | Format (pStr dest, Int maxsize, cpStr fmt, Bool local) |
| Formats the date/time value as specified by the format string. More... | |
| EString | Format (cpStr fmt, Bool local) |
| Formats the date/time value as specified by the format string. More... | |
| Bool | ParseDateTime (cpStr pszDate, Bool isLocal=True) |
| Parses the string containing the time and date. More... | |
Static Public Member Functions | |
| static ETime | Now () |
| Retrieves the current time. More... | |
Class for manipulating date and time of day values.
The format functions use printf like format specifiers. Here are the possible values:
| Specifier | Output |
|---|---|
| A | Full day of week name |
| a | Day of week name abbreviation |
| 0 | Milliseconds |
| 1 | Microseconds |
| B | Full month name |
| b or h | Abbreviated month name |
| c | Date and time, equivalent to "%a %b %e %H:%M:%S %Y" |
| D | Month, day and year. Equivalent to "%m/%d/%y" |
| C | Century number (2 digit) |
| d | 2 digit month |
| F | Year, month and day. Equivalent to "%Y-%m-%d" |
| e | Day of month |
| H | 2 digit hour of day (00-23) |
| i | ISO 8601 date and time. Equivalent to "%Y-%m-%dT%H:%M:%S.%0" |
| I | 2 digit hour of day (12-11) |
| l | hour of day (0-23) |
| k | hour of day (12-11) |
| j | 3 digit day of year |
| M | 2 digit minute (00-59) |
| m | 2 digit month (01-12) |
| p | AM/PM |
| n | New line |
| R | Hour and minute. Equivalent to "%H:%M" |
| r | Time using AM/PM. Equivalent to "%I:%M:%S %p" |
| S | Two digit seconds (00-59) |
| s | Epoch time |
| t | Tab character |
| T | Time in 24-hour. Equivalent to "%H:%M:%S" |
| u | Day of week as decimal. |
| U | Week number as decimal. |
| V | ISO week number. |
| G | Four digit year. |
| g | Two digit year. |
| v | Equivalent to "%e-%b-%Y" |
| w | Day of week as decimal. |
| W | Two digit week of year. |
| x | Date without time. Equivalent to "%m/%d/%y" |
| X | Time without date. Equivalent to "%H:%M:%S" |
| Y | Four digit year with century. |
| y | Two digit year without century. |
| Z | Timezone name. |
| z | Hour and minute offset. |
| + | Date/time with timezone. Equivalent to "%a, %d %b %Y %H:%M:%S %z" |
| % | Literal percent |
|
inline |
Default constructor. Initializes to current time.
|
inline |
Copy constructor.
|
inline |
Class constructor.
| sec | the number of seconds since 00:00 Coordinated Universal Time (UTC), January 1, 1970. |
| usec | the fractional number of micro seconds. |
|
inline |
Class constructor.
| ms | milliseconds. |
| ETime::ETime | ( | Int | year, |
| Int | mon, | ||
| Int | day, | ||
| Int | hour, | ||
| Int | min, | ||
| Int | sec, | ||
| Bool | isLocal | ||
| ) |
Class constructor.
| year | the year. |
| mon | the month. |
| day | the day of the month. |
| hour | the hour (24hr). |
| min | the minute of the hour. |
| sec | the seconds within the minute. |
| isLocal | indicates that this value represents a local time. |
|
inline |
Class destructor.
|
inline |
Adds the timeval amount to the current value.
| t | the timeval amount to add. |
|
inline |
Adds the specified days, hours minutes seconds and microseconds to the current value.
| days | the number of days to add. |
| hrs | the number of hours to add. |
| mins | the number of minutes to add. |
| secs | the number of seconds to add. |
| usecs | the number of microseconds to add. |
| Int ETime::day | ( | ) |
Retrieves the day.
|
inline |
Formats the date/time value as specified by the format string.
| fmt | the format string. |
| local | indicates if the time/date value is to be converted to the current timezone or not. |
| void ETime::Format | ( | EString & | dest, |
| cpStr | fmt, | ||
| Bool | local | ||
| ) |
Formats the date/time value as specified by the format string.
| dest | contains the resulting string. |
| fmt | the format string. |
| local | indicates if the time/date value is to be converted to the current timezone or not. |
| void ETime::Format | ( | pStr | dest, |
| Int | maxsize, | ||
| cpStr | fmt, | ||
| Bool | local | ||
| ) |
Formats the date/time value as specified by the format string.
| dest | contains the resulting string. |
| maxsize | the maximum length of dest. |
| fmt | the format string. |
| local | indicates if the time/date value is to be converted to the current timezone or not. |
|
inline |
Converts this ETime value to one compatible with a Cassandra timestamp.
| void ETime::getNTPTime | ( | ntp_time_t & | ntp | ) | const |
Retrieves the NTP time representation of this ETime object.
| ntp | the ntp_time_t object that will contain the result. |
|
inline |
Retrieves a reference to the timeval structure.
| Int ETime::hour | ( | ) |
Retrieves the hour.
|
inline |
Indicates whether this ETime object is valid or not.
| Int ETime::minute | ( | ) |
Retrieves the minute.
| Int ETime::month | ( | ) |
Retrieves the month.
|
inline |
Inequality operator.
| a | the ETime value to compare to. |
Addition operator.
| a | the ETime value to add to this value. |
|
inline |
Addition operator.
| t | the timeval value to add to this value. |
Subtraction operator.
| a | the ETime value to subtract from this value. |
|
inline |
Subtraction operator.
| t | the timeval value to subtract from this value. |
|
inline |
Less than operator.
| a | the ETime value to compare to. |
|
inline |
Less than or equal to operator.
| a | the ETime value to compare to. |
|
inline |
Assignment operator.
| a | the timeval value to copy. |
|
inline |
Assignment operator.
| ms | the milliseconds to set this value to. |
|
inline |
Equality operator.
| a | the ETime value to compare to. |
|
inline |
Greater than operator.
| a | the ETime value to compare to. |
|
inline |
Greater than or equal to operator.
| a | the ETime value to compare to. |
| bool ETime::ParseDateTime | ( | cpStr | pszDate, |
| Bool | isLocal = True |
||
| ) |
Parses the string containing the time and date.
| pszDate | NULL terminated string to parse. |
| isLocal | indicates if the time/date string is in local time or not. |
| Int ETime::second | ( | ) |
Retrieves the second.
|
inline |
Assigns the specified timeval value to this ETime object.
| a | the timeval value to assign. |
|
inline |
Assigns the specified millisecond value to this ETime object.
| ms | the millisecond value to assign. |
| void ETime::setNTPTime | ( | const ntp_time_t & | ntp | ) |
Assigns the time represented by the NTP time to this ETime object.
| ntp | the ntp_time_t object to assign. |
|
inline |
Subtracts the timeval amount to the current value.
| t | the timeval amount to subtract. |
|
inline |
Subtracts the specified days, hours minutes seconds and microseconds to the current value.
| days | the number of days to subtract. |
| hrs | the number of hours to subtract. |
| mins | the number of minutes to subtract. |
| secs | the number of seconds to subtract. |
| usecs | the number of microseconds to subtract. |
| Int ETime::year | ( | ) |
Retrieves the year.
1.8.16