Helper class that allows to convert time stamps as defined in LCEvent::getTimeStamp() ( ns since 1.1.1970 00:00:00 UTC) to ordinary date and time and vice versa. More...
#include <UTIL/LCTime.h>
Classes | |
| struct | CalendarTime |
| Helper struct that holds the calendar time. More... | |
Public Member Functions | |
| LCTime () | |
| Init with current time ( accuracy depends on OS/machine,etc. | |
| LCTime (EVENT::long64 time) | |
| Init from 64 bit time stamp ( ns since 1.1.1970 00:00:00 ). | |
| LCTime (int year, int month, int day, int hour=0, int min=0, int s=0) | |
| Init from date and time. | |
| LCTime (int unixTime) | |
| Init from unix time ( s since 1.1.1970 00:00:00 ). | |
| int | unixTime () const |
| Unix time ( s since 1.1.1970 00:00:00 ). | |
| EVENT::long64 | timeStamp () const |
| 64bit time stamp as used in LCEvent::getTimestamp(). | |
| bool | isLeapYear (int y) const |
| True if the year is a leap year in the Gregorian calendar: year is multiple of 4 and not multiple of 100 or year is multiple of 400. | |
| int | daysInYear (int y) const |
| The number if days in the given year in the Gregorian calendar. | |
| int | daysInMonth (int m, int y) const |
| The number if days in the given month and year in the Gregorian calendar. | |
| std::string | getDateString () const |
| Date in human readable format, e.g. | |
| const CalendarTime & | calendarTime () const |
| Calendar time: year,month,day hour,min,sec and ns. | |
| int | year () const |
| Calendar time: year. | |
| int | month () const |
| Calendar time: month. | |
| int | day () const |
| Calendar time: day. | |
| int | hour () const |
| Calendar time: hour. | |
| int | min () const |
| Calendar time: min. | |
| int | sec () const |
| Calendar time: sec. | |
| int | ns () const |
| Calendar time: ns. | |
| void | operator+= (EVENT::long64 t) |
| Add the specified number of ns to the time. | |
Static Public Member Functions | |
| static bool | test (int nDates) |
| Tests the LCTime class with nDates random dates Returns true if successful - throws Exception in case of error. | |
Protected Member Functions | |
| void | convertToCalTime () |
| void | convertFromCalTime () |
Static Protected Attributes | |
| static int | dpm [13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 } |
Helper class that allows to convert time stamps as defined in LCEvent::getTimeStamp() ( ns since 1.1.1970 00:00:00 UTC) to ordinary date and time and vice versa.
Dates and times are in UTC/GMT by default.
Negative time stamps are not supported and mapped to 0LL and 1.1.1970 00:00:00 UTC respectively.
| UTIL::LCTime::LCTime | ( | ) |
Init with current time ( accuracy depends on OS/machine,etc.
) in UTC/GMT.
| int UTIL::LCTime::daysInMonth | ( | int | m, | |
| int | y | |||
| ) | const |
The number if days in the given month and year in the Gregorian calendar.
References isLeapYear().
| int UTIL::LCTime::daysInYear | ( | int | y | ) | const |
The number if days in the given year in the Gregorian calendar.
References isLeapYear().
| std::string UTIL::LCTime::getDateString | ( | ) | const |
1.6.1