1 #ifndef GAUDIKERNEL_TIME_H 2 #define GAUDIKERNEL_TIME_H 1 31 typedef struct _FILETIME FILETIME;
67 TimeSpan( ValueType secs,
int nsecs );
68 TimeSpan(
int days,
int hours,
int mins,
int secs,
int nsecs );
73 ValueType seconds()
const;
75 int lastHours()
const;
76 int lastMinutes()
const;
77 int lastSeconds()
const;
78 int lastNSeconds()
const;
111 ValueType m_nsecs = 0;
261 static const int SECS_PER_DAY = 86400;
264 static const int SECS_PER_HOUR = 3600;
267 static const ValueType SEC_NSECS = 1000000000;
273 Time( ValueType nsecs );
274 Time( ValueType secs,
int nsecs );
275 Time(
int year,
int month,
int day,
int hour,
int min,
int sec, ValueType nsecs,
bool local =
true );
285 static Time current();
287 static Time from(
const FILETIME* systime );
289 static Time build(
bool local,
const tm& base,
TimeSpan diff = 0 );
291 tm split(
bool local,
int* nsecpart = 0 )
const;
292 tm utc(
int* nsecpart = 0 )
const;
293 tm local(
int* nsecpart = 0 )
const;
295 int year(
bool local )
const;
296 int month(
bool local )
const;
297 int day(
bool local )
const;
298 int hour(
bool local )
const;
299 int minute(
bool local )
const;
300 int second(
bool local )
const;
302 int weekday(
bool local )
const;
303 bool isdst(
bool local )
const;
305 ValueType utcoffset(
int* daylight = 0 )
const;
306 const char* timezone(
int* daylight = 0 )
const;
311 ValueType
ns()
const;
314 std::string nanoformat(
size_t minwidth = 1,
size_t maxwidth = 9 )
const;
316 static bool isLeap(
int year );
319 static unsigned toDosDate(
Time time );
320 static Time fromDosDate(
unsigned dosDate );
335 ValueType m_nsecs = 0;
346 #endif // GAUDIKERNEL_TIME_H
constexpr static const auto FAILURE
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)
void TimeAssert(bool cond, const std::string &msg="time assertion failed") const
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)
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.