EIC Software
Reference for
EIC
simulation and reconstruction software on GitHub
|
#include <EicRoot/blob/master/dbase/dbValidation/ValTimeStamp.h>
Public Member Functions | |
ValTimeStamp () | |
Empty ctor (builds current time with nsec field filled as best possible) | |
ValTimeStamp (const ValTimeStamp &source) | |
Copy. | |
ValTimeStamp & | operator= (const ValTimeStamp &source) |
Assignment. | |
ValTimeStamp (const timespec_t &ts) | |
Construction from timespec struct. | |
ValTimeStamp (const time_t &t, const Int_t nsec) | |
Construction from time_t and separate nsec. | |
ValTimeStamp (UInt_t year, UInt_t month, UInt_t day, UInt_t hour, UInt_t min, UInt_t sec, UInt_t nsec=0, Bool_t isUTC=kTRUE, Int_t secOffset=0) | |
ValTimeStamp (UInt_t date, UInt_t time, UInt_t nsec, Bool_t isUTC=kTRUE, Int_t secOffset=0) | |
ValTimeStamp (Double_t seconds) | |
virtual | ~ValTimeStamp () |
operator double () const | |
timespec_t | GetTimeSpec () const |
Get timestamp as a timespec_t. | |
time_t | GetSec (void) const |
Get (integral) seconds after the EPOCH. | |
Int_t | GetNanoSec (void) const |
Get nanoseconds after the second. | |
Double_t | GetSeconds (void) const |
Get time from the epoch in seconds. | |
const char * | AsString (Option_t *option="") const |
void | Copy (ValTimeStamp &vldts) const |
Int_t | GetDate (Bool_t inUTC=kTRUE, Int_t secOffset=0, UInt_t *year=0, UInt_t *month=0, UInt_t *day=0) const |
Int_t | GetTime (Bool_t inUTC=kTRUE, Int_t secOffset=0, UInt_t *hour=0, UInt_t *min=0, UInt_t *sec=0) const |
void | Add (const ValTimeStamp &offset) |
void | Add (Double_t seconds) |
void | Print (Option_t *option="") const |
Static Public Member Functions | |
static ValTimeStamp | GetBOT () |
Static method to return the "beginning of time" (start of Unix EPOCH) | |
static ValTimeStamp | GetEOT () |
static ValTimeStamp | GetNBOT () |
static Int_t | GetZoneOffset () |
static time_t | MktimeFromUTC (tm_t *tmstruct) |
static Bool_t | IsLeapYear (Int_t year) |
Is the given year a leap year. | |
static void | DumpTMStruct (const tm_t &tmstruct) |
Print out the "tm" structure: | |
Private Member Functions | |
void | Set () |
void | Set (Int_t year, Int_t month, Int_t day, Int_t hour, Int_t min, Int_t sec, Int_t nsec, Bool_t isUTC, Int_t secOffset) |
void | Set (Int_t date, Int_t time, Int_t nsec, Bool_t isUTC, Int_t secOffset) |
void | NormalizeNanoSec () |
Private Attributes | |
Int_t | fSec |
Int_t | fNanoSec |
Friends | |
Bool_t | operator== (const ValTimeStamp &lhs, const ValTimeStamp &rhs) |
Bool_t | operator!= (const ValTimeStamp &lhs, const ValTimeStamp &rhs) |
Bool_t | operator< (const ValTimeStamp &lhs, const ValTimeStamp &rhs) |
Bool_t | operator<= (const ValTimeStamp &lhs, const ValTimeStamp &rhs) |
Bool_t | operator> (const ValTimeStamp &lhs, const ValTimeStamp &rhs) |
Bool_t | operator>= (const ValTimeStamp &lhs, const ValTimeStamp &rhs) |
ValTimeStamp | operator- (const ValTimeStamp &lhs, const ValTimeStamp &rhs) |
Definition at line 16 of file ValTimeStamp.h.
View newest version in sPHENIX GitHub at line 16 of file ValTimeStamp.h
ValTimeStamp::ValTimeStamp | ( | ) |
Empty ctor (builds current time with nsec field filled as best possible)
Definition at line 47 of file ValTimeStamp.cxx.
View newest version in sPHENIX GitHub at line 47 of file ValTimeStamp.cxx
References Set().
Referenced by GetBOT(), GetEOT(), and GetNBOT().
|
inline |
Copy.
Definition at line 46 of file ValTimeStamp.h.
View newest version in sPHENIX GitHub at line 46 of file ValTimeStamp.h
|
inline |
Construction from timespec struct.
Definition at line 56 of file ValTimeStamp.h.
View newest version in sPHENIX GitHub at line 56 of file ValTimeStamp.h
|
inline |
Construction from time_t and separate nsec.
Definition at line 61 of file ValTimeStamp.h.
View newest version in sPHENIX GitHub at line 61 of file ValTimeStamp.h
ValTimeStamp::ValTimeStamp | ( | UInt_t | year, |
UInt_t | month, | ||
UInt_t | day, | ||
UInt_t | hour, | ||
UInt_t | min, | ||
UInt_t | sec, | ||
UInt_t | nsec = 0 , |
||
Bool_t | isUTC = kTRUE , |
||
Int_t | secOffset = 0 |
||
) |
Create a ValTimeStamp and set it to the specified year, month, day, time, hour, minute, second and nanosec. If !isUTC then it is assumed to be the standard local time zone.
If local time is PST then one can use
ValTimeStamp(year,month,day,hour,min,sec,nsec,kFALSE,0);
or
Int_t secOffset = 8*60*60; ValTimeStamp(year,month,day,hour,min,sec,nsec,kTRUE,8*60*60);
Definition at line 51 of file ValTimeStamp.cxx.
View newest version in sPHENIX GitHub at line 51 of file ValTimeStamp.cxx
References Set().
ValTimeStamp::ValTimeStamp | ( | UInt_t | date, |
UInt_t | time, | ||
UInt_t | nsec, | ||
Bool_t | isUTC = kTRUE , |
||
Int_t | secOffset = 0 |
||
) |
Create a ValTimeStamp and set it to the specified date, time, nanosec. If !isUTC then it is assumed to be the standard local time zone.
Definition at line 72 of file ValTimeStamp.cxx.
View newest version in sPHENIX GitHub at line 72 of file ValTimeStamp.cxx
References Set().
|
inline |
Create a ValTimeStamp using double precision floating point seconds from the EPOCH.
Definition at line 95 of file ValTimeStamp.h.
View newest version in sPHENIX GitHub at line 95 of file ValTimeStamp.h
|
virtual |
Definition at line 48 of file ValTimeStamp.cxx.
View newest version in sPHENIX GitHub at line 48 of file ValTimeStamp.cxx
void ValTimeStamp::Add | ( | const ValTimeStamp & | offset | ) |
Definition at line 248 of file ValTimeStamp.cxx.
View newest version in sPHENIX GitHub at line 248 of file ValTimeStamp.cxx
References fNanoSec, fSec, and NormalizeNanoSec().
void ValTimeStamp::Add | ( | Double_t | seconds | ) |
Definition at line 258 of file ValTimeStamp.cxx.
View newest version in sPHENIX GitHub at line 258 of file ValTimeStamp.cxx
References fNanoSec, fSec, and NormalizeNanoSec().
const char * ValTimeStamp::AsString | ( | Option_t * | option = "" | ) | const |
Return the date & time as a string.
Result is pointer to a statically allocated string. User should copy this into their own buffer before calling this method again. This is somewhat mitigated by use of a circular buffer of strings.
Option "l" returns it in local zone format (can be applied to default or compact format).
Default format is RFC822 compliant: "Mon, 02 Jan 2001 18:11:12 +0000 (GMT) +999999999 nsec" "Mon, 02 Jan 2001 10:11:12 -0800 (PST) +999999999 nsec"
Option "c" compact is (almost) ISO 8601 compliant: "2001-01-02 18:11:12.9999999999Z" "2001-01-02 10:11:12.9999999999-0800" if PST
Option "2" returns as {sec,nsec} integers.
Option "s" returns "2001-01-02 18:11:12" with an implied UTC, overrides "l" option.
Internally uses a circular list of buffers to avoid problems using AsString multiple times in a single statement.
Definition at line 83 of file ValTimeStamp.cxx.
View newest version in sPHENIX GitHub at line 83 of file ValTimeStamp.cxx
References fNanoSec, and fSec.
Referenced by ValContext::AsString(), FairDbResultKey::AsString(), ValRange::AsString(), ValValidate::CompareTimeStamps(), FairDbSqlContext::FairDbSqlContext(), FairDbValidityRec::GetL2CacheName(), FairDb::MakeDateTimeString(), operator<<(), Print(), FairDbProxy::ReplaceInsertDate(), FairDbSqlValPacket::SetCreationDate(), and ValValidate::TestTimeStamp().
void ValTimeStamp::Copy | ( | ValTimeStamp & | vldts | ) | const |
Definition at line 180 of file ValTimeStamp.cxx.
View newest version in sPHENIX GitHub at line 180 of file ValTimeStamp.cxx
|
static |
Print out the "tm" structure:
Definition at line 532 of file ValTimeStamp.cxx.
View newest version in sPHENIX GitHub at line 532 of file ValTimeStamp.cxx
References printf().
|
static |
Static method to return the "beginning of time" (start of Unix EPOCH)
Definition at line 26 of file ValTimeStamp.cxx.
View newest version in sPHENIX GitHub at line 26 of file ValTimeStamp.cxx
References ValTimeStamp().
Int_t ValTimeStamp::GetDate | ( | Bool_t | inUTC = kTRUE , |
Int_t | secOffset = 0 , |
||
UInt_t * | year = 0 , |
||
UInt_t * | month = 0 , |
||
UInt_t * | day = 0 |
||
) | const |
Return date in form of 19971224 (i.e. 24/12/1997), if non-zero pointers supplied for year, month, day fill those as well
Definition at line 190 of file ValTimeStamp.cxx.
View newest version in sPHENIX GitHub at line 190 of file ValTimeStamp.cxx
References fSec.
Referenced by FairDb::MakeTimeStamp(), and ValValidate::TestTimeStamp().
|
static |
Static method to return the "end of time" which is sometime in the future and near or at the limit of ValTimeStamp's ability to hold large times.
Definition at line 31 of file ValTimeStamp.cxx.
View newest version in sPHENIX GitHub at line 31 of file ValTimeStamp.cxx
References ValTimeStamp().
|
inline |
Get nanoseconds after the second.
Definition at line 119 of file ValTimeStamp.h.
View newest version in sPHENIX GitHub at line 119 of file ValTimeStamp.h
Referenced by operator-().
|
static |
Static method to return the "negative beginning of time", i.e. the earliest time prior to start of Unix EPOCH which is negative seconds.
Definition at line 36 of file ValTimeStamp.cxx.
View newest version in sPHENIX GitHub at line 36 of file ValTimeStamp.cxx
References ValTimeStamp().
|
inline |
Get (integral) seconds after the EPOCH.
Definition at line 117 of file ValTimeStamp.h.
View newest version in sPHENIX GitHub at line 117 of file ValTimeStamp.h
Referenced by ClassImp(), FairDbProxy::FindTimeBoundaries(), FairDbValidityRecBuilder::MakeGapRec(), operator-(), FairDbTableProxy::QueryOverlayCreationDate(), and FairDbProxy::QueryValidity().
|
inline |
Get time from the epoch in seconds.
Definition at line 122 of file ValTimeStamp.h.
View newest version in sPHENIX GitHub at line 122 of file ValTimeStamp.h
Int_t ValTimeStamp::GetTime | ( | Bool_t | inUTC = kTRUE , |
Int_t | secOffset = 0 , |
||
UInt_t * | hour = 0 , |
||
UInt_t * | min = 0 , |
||
UInt_t * | sec = 0 |
||
) | const |
Return time in form of 123623 (i.e. 12:36:23), if non-zero pointers supplied for hour, min, sec fill those as well
Definition at line 208 of file ValTimeStamp.cxx.
View newest version in sPHENIX GitHub at line 208 of file ValTimeStamp.cxx
References fSec.
Referenced by ValValidate::TestTimeStamp().
|
inline |
Get timestamp as a timespec_t.
Definition at line 113 of file ValTimeStamp.h.
View newest version in sPHENIX GitHub at line 113 of file ValTimeStamp.h
References value.
Referenced by ValValidate::TestTimeStamp().
|
static |
Static method returning local (current) time zone offset from UTC. This is the difference in seconds between UTC and local standard time.
Definition at line 226 of file ValTimeStamp.cxx.
View newest version in sPHENIX GitHub at line 226 of file ValTimeStamp.cxx
References Acts::Test::time.
Referenced by ValValidate::TestTimeStamp().
|
static |
Is the given year a leap year.
Definition at line 501 of file ValTimeStamp.cxx.
View newest version in sPHENIX GitHub at line 501 of file ValTimeStamp.cxx
Referenced by MktimeFromUTC().
|
static |
Equivalent of standard routine "mktime" but using the assumption that tm struct is filled with UTC, not local, time.
This version ISN'T configured to handle every possible weirdness of out-of-range values in the case of normalizing the tm struct.
This version DOESN'T correctly handle values that can't be fit into a time_t (i.e. beyond year 2038-01-18 19:14:07, or before the start of Epoch).
Definition at line 443 of file ValTimeStamp.cxx.
View newest version in sPHENIX GitHub at line 443 of file ValTimeStamp.cxx
References IsLeapYear().
Referenced by Set().
|
private |
Definition at line 427 of file ValTimeStamp.cxx.
View newest version in sPHENIX GitHub at line 427 of file ValTimeStamp.cxx
References fNanoSec, and fSec.
Referenced by Add(), and Set().
|
inline |
Implicitly convert a ValTimeStamp to a double.
Definition at line 109 of file ValTimeStamp.h.
View newest version in sPHENIX GitHub at line 109 of file ValTimeStamp.h
|
inline |
Assignment.
Definition at line 50 of file ValTimeStamp.h.
View newest version in sPHENIX GitHub at line 50 of file ValTimeStamp.h
void ValTimeStamp::Print | ( | Option_t * | option = "" | ) | const |
Definition at line 273 of file ValTimeStamp.cxx.
View newest version in sPHENIX GitHub at line 273 of file ValTimeStamp.cxx
References AsString(), and printf().
Referenced by ValValidate::TestTimeStamp().
|
private |
Definition at line 282 of file ValTimeStamp.cxx.
View newest version in sPHENIX GitHub at line 282 of file ValTimeStamp.cxx
References fNanoSec, fSec, and Acts::Test::time.
Referenced by Set(), and ValTimeStamp().
|
private |
Definition at line 331 of file ValTimeStamp.cxx.
View newest version in sPHENIX GitHub at line 331 of file ValTimeStamp.cxx
References fNanoSec, fSec, min, MktimeFromUTC(), and NormalizeNanoSec().
|
private |
Definition at line 386 of file ValTimeStamp.cxx.
View newest version in sPHENIX GitHub at line 386 of file ValTimeStamp.cxx
|
friend |
Definition at line 226 of file ValTimeStamp.h.
View newest version in sPHENIX GitHub at line 226 of file ValTimeStamp.h
|
friend |
Definition at line 260 of file ValTimeStamp.h.
View newest version in sPHENIX GitHub at line 260 of file ValTimeStamp.h
|
friend |
Definition at line 232 of file ValTimeStamp.h.
View newest version in sPHENIX GitHub at line 232 of file ValTimeStamp.h
|
friend |
Definition at line 239 of file ValTimeStamp.h.
View newest version in sPHENIX GitHub at line 239 of file ValTimeStamp.h
|
friend |
Definition at line 220 of file ValTimeStamp.h.
View newest version in sPHENIX GitHub at line 220 of file ValTimeStamp.h
|
friend |
Definition at line 246 of file ValTimeStamp.h.
View newest version in sPHENIX GitHub at line 246 of file ValTimeStamp.h
|
friend |
Definition at line 253 of file ValTimeStamp.h.
View newest version in sPHENIX GitHub at line 253 of file ValTimeStamp.h
|
private |
Definition at line 213 of file ValTimeStamp.h.
View newest version in sPHENIX GitHub at line 213 of file ValTimeStamp.h
Referenced by Add(), AsString(), Copy(), NormalizeNanoSec(), operator!=(), operator<(), operator<=(), operator=(), operator==(), operator>(), operator>=(), and Set().
|
private |
Definition at line 212 of file ValTimeStamp.h.
View newest version in sPHENIX GitHub at line 212 of file ValTimeStamp.h
Referenced by Add(), AsString(), Copy(), GetDate(), GetTime(), NormalizeNanoSec(), operator!=(), operator<(), operator<=(), operator=(), operator==(), operator>(), operator>=(), and Set().