2 #ifndef GAUDIKERNEL_TIME_H
3 #define GAUDIKERNEL_TIME_H 1
7 #include "GaudiKernel/Kernel.h"
8 #include "GaudiKernel/StreamBuffer.h"
9 #include "GaudiKernel/GaudiException.h"
25 const std::string& Tag =
"*Gaudi::Time*",
34 typedef struct _FILETIME FILETIME;
64 TimeSpan (ValueType nsecs);
65 TimeSpan (ValueType secs,
int nsecs);
66 TimeSpan (
int days,
int hours,
int mins,
int secs,
int nsecs);
68 int days (
void)
const;
69 int hours (
void)
const;
70 int minutes (
void)
const;
71 ValueType seconds (
void)
const;
73 int lastHours (
void)
const;
74 int lastMinutes (
void)
const;
75 int lastSeconds (
void)
const;
76 int lastNSeconds (
void)
const;
78 TimeSpan & operator+= (
const TimeSpan &x);
79 TimeSpan & operator-= (
const TimeSpan &x);
80 TimeSpan & operator*= (
const TimeSpan &
n);
81 TimeSpan & operator/= (
const TimeSpan &
n);
82 TimeSpan & operator%= (
const TimeSpan &
n);
84 ValueType
ns (
void)
const;
215 friend class TimeSpan;
236 static const int SECS_PER_DAY = 86400;
239 static const int SECS_PER_HOUR = 3600;
242 static const ValueType SEC_NSECS = 1000000000;
246 Time (ValueType nsecs);
247 Time (ValueType secs,
int nsecs);
248 Time (
int year,
int month,
int day,
int hour,
int min,
int sec,
249 ValueType nsecs,
bool local =
true);
255 static Time epoch (
void);
257 static Time max (
void);
259 static Time current (
void);
261 static Time from (
const FILETIME *systime);
263 static Time
build (
bool local,
const tm &base, TimeSpan diff = 0);
265 tm split (
bool local,
int *nsecpart = 0)
const;
266 tm utc (
int *nsecpart = 0)
const;
267 tm local (
int *nsecpart = 0)
const;
269 int year (
bool local)
const;
270 int month (
bool local)
const;
271 int day (
bool local)
const;
272 int hour (
bool local)
const;
273 int minute (
bool local)
const;
274 int second (
bool local)
const;
275 int nsecond (
void)
const;
276 int weekday (
bool local)
const;
277 bool isdst (
bool local)
const;
279 ValueType utcoffset (
int *daylight = 0)
const;
280 const char * timezone (
int *daylight = 0)
const;
282 Time & operator+= (
const TimeSpan &x);
283 Time & operator-= (
const TimeSpan &x);
285 ValueType
ns (
void)
const;
287 std::string
format (
bool local, std::string spec =
"%c")
const;
288 std::string nanoformat (
size_t minwidth = 1,
size_t maxwidth = 9)
const;
290 static bool isLeap (
int year);
293 static unsigned toDosDate (Time time);
294 static Time fromDosDate (
unsigned dosDate);
299 inline void TimeAssert(
bool cond,
const std::string &
msg =
"time assertion failed")
const {
307 #include "GaudiKernel/Time.icpp"
309 #endif // GAUDIKERNEL_TIME_H
Define general base for Gaudi exception.
This class is used for returning status codes from appropriate routines.
Exception thrown by Gaudi::Time.
Helper functions to set/get the application return code.
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".