1 #ifndef GAUDIKERNEL_TIME_H
2 #define GAUDIKERNEL_TIME_H 1
6 #include "GaudiKernel/Kernel.h"
7 #include "GaudiKernel/StreamBuffer.h"
8 #include "GaudiKernel/GaudiException.h"
24 std::string Tag =
"*Gaudi::Time*",
33 typedef struct _FILETIME FILETIME;
63 TimeSpan (ValueType nsecs);
64 TimeSpan (ValueType secs,
int nsecs);
65 TimeSpan (
int days,
int hours,
int mins,
int secs,
int nsecs);
67 int days (
void)
const;
68 int hours (
void)
const;
69 int minutes (
void)
const;
70 ValueType seconds (
void)
const;
72 int lastHours (
void)
const;
73 int lastMinutes (
void)
const;
74 int lastSeconds (
void)
const;
75 int lastNSeconds (
void)
const;
77 TimeSpan & operator+= (
const TimeSpan &x);
78 TimeSpan & operator-= (
const TimeSpan &x);
79 TimeSpan & operator*= (
const TimeSpan &
n);
80 TimeSpan & operator/= (
const TimeSpan &
n);
81 TimeSpan & operator%= (
const TimeSpan &
n);
83 ValueType
ns (
void)
const;
214 friend class TimeSpan;
235 static const int SECS_PER_DAY = 86400;
238 static const int SECS_PER_HOUR = 3600;
241 static const ValueType SEC_NSECS = 1000000000;
245 Time (ValueType nsecs);
246 Time (ValueType secs,
int nsecs);
247 Time (
int year,
int month,
int day,
int hour,
int min,
int sec,
248 ValueType nsecs,
bool local =
true);
254 static Time epoch (
void);
256 static Time max (
void);
258 static Time current (
void);
260 static Time from (
const FILETIME *systime);
262 static Time
build (
bool local,
const tm &base, TimeSpan diff = 0);
264 tm split (
bool local,
int *nsecpart = 0)
const;
265 tm utc (
int *nsecpart = 0)
const;
266 tm local (
int *nsecpart = 0)
const;
268 int year (
bool local)
const;
269 int month (
bool local)
const;
270 int day (
bool local)
const;
271 int hour (
bool local)
const;
272 int minute (
bool local)
const;
273 int second (
bool local)
const;
274 int nsecond (
void)
const;
275 int weekday (
bool local)
const;
276 bool isdst (
bool local)
const;
278 ValueType utcoffset (
int *daylight = 0)
const;
279 const char * timezone (
int *daylight = 0)
const;
281 Time & operator+= (
const TimeSpan &x);
282 Time & operator-= (
const TimeSpan &x);
284 ValueType
ns (
void)
const;
286 std::string
format (
bool local, std::string spec =
"%c")
const;
287 std::string nanoformat (
size_t minwidth = 1,
size_t maxwidth = 9)
const;
289 static bool isLeap (
int year);
292 static unsigned toDosDate (Time
time);
293 static Time fromDosDate (
unsigned dosDate);
298 inline void TimeAssert(
bool cond,
const std::string &
msg =
"time assertion failed")
const {
306 #include "GaudiKernel/Time.icpp"
308 #endif // GAUDIKERNEL_TIME_H
Define general base for Gaudi exception.
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
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.