1 #ifndef GAUDIKERNEL_TIME_H 2 #define GAUDIKERNEL_TIME_H 1 29 typedef struct _FILETIME FILETIME;
63 TimeSpan( ValueType secs,
int nsecs );
64 TimeSpan(
int days,
int hours,
int mins,
int secs,
int nsecs );
69 ValueType seconds()
const;
71 int lastHours()
const;
72 int lastMinutes()
const;
73 int lastSeconds()
const;
74 int lastNSeconds()
const;
105 ValueType m_nsecs = 0;
254 static const int SECS_PER_DAY = 86400;
257 static const int SECS_PER_HOUR = 3600;
260 static const ValueType SEC_NSECS = 1000000000;
266 Time( ValueType nsecs );
267 Time( ValueType secs,
int nsecs );
268 Time(
int year,
int month,
int day,
int hour,
int min,
int sec, ValueType nsecs,
bool local =
true );
278 static Time current();
280 static Time from(
const FILETIME* systime );
282 static Time build(
bool local,
const tm& base,
TimeSpan diff = 0 );
284 tm split(
bool local,
int* nsecpart = 0 )
const;
285 tm utc(
int* nsecpart = 0 )
const;
286 tm local(
int* nsecpart = 0 )
const;
288 int year(
bool local )
const;
289 int month(
bool local )
const;
290 int day(
bool local )
const;
291 int hour(
bool local )
const;
292 int minute(
bool local )
const;
293 int second(
bool local )
const;
295 int weekday(
bool local )
const;
296 bool isdst(
bool local )
const;
298 ValueType utcoffset(
int* daylight = 0 )
const;
299 const char* timezone(
int* daylight = 0 )
const;
304 ValueType
ns()
const;
307 std::string nanoformat(
size_t minwidth = 1,
size_t maxwidth = 9 )
const;
309 static bool isLeap(
int year );
312 static unsigned toDosDate(
Time time );
313 static Time fromDosDate(
unsigned dosDate );
328 ValueType m_nsecs = 0;
338 #endif // GAUDIKERNEL_TIME_H friend bool operator==(const Gaudi::Time &t1, const Gaudi::Time &t2)
Define general base for Gaudi exception.
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
friend bool operator<(const Gaudi::Time &t1, const Gaudi::Time &t2)
friend bool operator==(const Gaudi::TimeSpan &t1, const Gaudi::TimeSpan &t2)
friend bool operator!=(const Gaudi::TimeSpan &t1, const Gaudi::TimeSpan &t2)
EventIDBase min(const EventIDBase &lhs, const EventIDBase &rhs)
void TimeAssert(bool cond, const std::string &msg="time assertion failed") const
EventIDBase max(const EventIDBase &lhs, const EventIDBase &rhs)
friend bool operator<=(const Gaudi::TimeSpan &t1, const Gaudi::TimeSpan &t2)
friend Gaudi::TimeSpan operator+(const Gaudi::TimeSpan &ts1, const Gaudi::TimeSpan &ts2)
Months
Symbolic names for months.
ValueType ns() const
Return the time span as nanoseconds.
This class is used for returning status codes from appropriate routines.
friend bool operator>(const Gaudi::TimeSpan &t1, const Gaudi::TimeSpan &t2)
Exception thrown by Gaudi::Time.
friend bool operator>=(const Gaudi::Time &t1, const Gaudi::Time &t2)
friend bool operator<=(const Gaudi::Time &t1, const Gaudi::Time &t2)
friend bool operator>(const Gaudi::Time &t1, const Gaudi::Time &t2)
TimeException(std::string Message="unspecified exception", std::string Tag="*Gaudi::Time*", StatusCode Code=StatusCode::FAILURE)
constexpr static const auto FAILURE
ValueType ns() const
Return the time as nanoseconds since 00:00:00 on January 1, 1970 in UTC.
friend Gaudi::TimeSpan operator-(const Gaudi::TimeSpan &ts1, const Gaudi::TimeSpan &ts2)
friend bool operator!=(const Gaudi::Time &t1, const Gaudi::Time &t2)
friend bool operator<(const Gaudi::TimeSpan &t1, const Gaudi::TimeSpan &t2)
friend bool operator>=(const Gaudi::TimeSpan &t1, const Gaudi::TimeSpan &t2)
Helper functions to set/get the application return code.