#include <owl/time.h>
OWLTime a;
#include <owl/time.h>
int main(void) cout << "Current time is: " << now << endl; const char * test_time = "25/05/00 17:34:59"; OWLTime test(test_time); cout << "Check parsed test time \'" <<
test_time
<< "\':" << endl return 0; |
The output of the program is the following (exact value of current time differ):
Current time is: 14/11/00 17:44:31 Check parsed test time '25/05/00 17:34:59': - year = 2000 - month = 4 - day = 25 - hour = 17 - minute = 34 - second = 59 - microseconds = 123456 |
enum Precision { Seconds, Microseconds };
OWLTime(Precision prc = Seconds);
OWLTime(const char * );
Constructs a time from reference to struct tm (it is expected that that struct was filled by one of the system functions like localtime or gmtime).OWLTime (time_t seconds, time_t microseconds = 0)
Constructs a time from number of seconds and microseconds since epoch (00:00:00.000000 01/01/70).
The number of years since 0.unsigned short month() const;
The number of months since January, in the range 0 to 11.unsigned short day() const;
The day of the month, in the range 1 to 31.unsigned short hour() const;
The number of hours past midnight, in the range 0 to 23.unsigned short min() const;
The number of minutes after the hour, in the range 0 to 59.unsigned short sec() const;
The number of seconds after the minute, normally in the range 0 to 59, but can be up to 61 to allow for leap seconds.unsigned long mksec() const;
The number of microseconds after the seconds, in the range 0 to 999999.long long total_mksec_utc() const;
The total number of microseconds sinse epoch in UTC.char * c_str() const;
Returns time as a C-string. The user is responsible to delete (i.e. call delete[]) this string when it is not needed.
Logical compare operators.ostream& operator<<(ostream&, const OWLTime&);
Output stream operator.