2 #ifndef GAUDIKERNEL_TIME_ICPP
3 #define GAUDIKERNEL_TIME_ICPP 1
27 : m_nsecs(secs *
Time::SEC_NSECS + nsecs) {
60 return 0x7fffffffffffffffLL;
65 return ((year % 4) == 0
67 || (year % 400) == 0));
91 : m_nsecs(secs *
Time::SEC_NSECS + nsecs) {}
226 return t1.
ns() == t2.
ns();
230 return t1.
ns() != t2.
ns();
234 return t1.
ns() < t2.
ns();
238 return t1.
ns() <= t2.
ns();
242 return t1.
ns() > t2.
ns();
246 return t1.
ns() >= t2.
ns();
286 return t1.
ns() == t2.
ns();
290 return t1.
ns() != t2.
ns();
294 return t1.
ns() < t2.
ns();
298 return t1.
ns() <= t2.
ns();
302 return t1.
ns() > t2.
ns();
306 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.
This is a number of static methods for bootstrapping the Gaudi framework.
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)
int hours(void) const
Get the number of complete hours in the span.