1 #ifndef GAUDIKERNEL_TIME_ICPP
2 #define GAUDIKERNEL_TIME_ICPP 1
26 : m_nsecs(secs *
Time::SEC_NSECS + nsecs) {
59 return 0x7fffffffffffffffLL;
64 return ((year % 4) == 0
66 || (year % 400) == 0));
90 : m_nsecs(secs *
Time::SEC_NSECS + nsecs) {}
225 return t1.
ns() == t2.
ns();
229 return t1.
ns() != t2.
ns();
233 return t1.
ns() < t2.
ns();
237 return t1.
ns() <= t2.
ns();
241 return t1.
ns() > t2.
ns();
245 return t1.
ns() >= t2.
ns();
285 return t1.
ns() == t2.
ns();
289 return t1.
ns() != t2.
ns();
293 return t1.
ns() < t2.
ns();
297 return t1.
ns() <= t2.
ns();
301 return t1.
ns() > t2.
ns();
305 return t1.
ns() >= t2.
ns();
ValueType seconds(void) const
Get the number of complete seconds in the span.
ValueType ns(void) const
Return the time span as nanoseconds.
GAUDI_API std::ostream & operator<<(std::ostream &o, const Gaudi::Histo1DDef &histo)
the streamer operator for class Gaudi::Histo1DDef
static const int SECS_PER_HOUR
Seconds in one hour hour.
bool operator!(const Gaudi::Time &t)
TimeSpan & operator/=(const TimeSpan &n)
Divide a time span.
The stream buffer is a small object collecting object data.
int days(void) const
Get the number of complete days in the span.
Gaudi::Time operator+(const Gaudi::Time &t, const Gaudi::TimeSpan &ts)
bool operator<=(const Gaudi::Time &t1, const Gaudi::Time &t2)
int lastMinutes(void) const
Get the number of complete minutes in the last incomplete hour of the span.
bool operator>=(const Gaudi::Time &t1, const Gaudi::Time &t2)
int lastNSeconds(void) const
Get the number of nanoseconds in the last incomplete second of the span.
Gaudi::TimeSpan operator-(const Gaudi::Time &t1, const Gaudi::Time &t2)
void TimeAssert(bool cond, const std::string &msg="time assertion failed") const
TimeSpan & operator*=(const TimeSpan &n)
Multiply a time span.
int lastSeconds(void) const
Get the number of complete seconds in the last incomplete minute of the span.
ValueType ns(void) const
Return the time as nanoseconds since 00:00:00 on January 1, 1970 in UTC.
TimeSpan & operator+=(const TimeSpan &x)
Add to a time span.
static const ValueType SEC_NSECS
Nanoseconds in one second.
bool operator!=(const Gaudi::Time &t1, const Gaudi::Time &t2)
TimeSpan & operator-=(const TimeSpan &x)
Subtract from a time span.
bool operator>(const Gaudi::Time &t1, const Gaudi::Time &t2)
int minutes(void) const
Get the number of complete minutes in the span.
std::string nanoformat(size_t minwidth=1, size_t maxwidth=9) const
Format the nanosecond fractional part of the time as a string.
TimeSpan & operator%=(const TimeSpan &n)
Compute a modulo of a time span.
Time & operator+=(const TimeSpan &x)
Add the specified amount to the time.
static bool isLeap(int year)
Check if the year is a leap-year.
static Time epoch(void)
Returns the minimum time.
int lastHours(void) const
Get the number of complete hours in the last incomplete day of the span.
static const int SECS_PER_DAY
Seconds in 24 hours.
Time(void)
Initialize an empty (zero) time value.
TimeSpan(void)
Initialize an empty (zero) time difference.
StreamBuffer & operator>>(StreamBuffer &s, Gaudi::Time &t)
bool operator<(const Gaudi::Time &t1, const Gaudi::Time &t2)
StreamBuffer & operator<<(StreamBuffer &s, const Gaudi::Time &t)
Time & operator-=(const TimeSpan &x)
Subtract the specified amount from the time.
static Time max(void)
Returns the maximum time.
bool operator==(const Gaudi::Time &t1, const Gaudi::Time &t2)
Helper functions to set/get the application return code.
int hours(void) const
Get the number of complete hours in the span.