A++ » INCLUDE » TTimeStamp

class TTimeStamp


 The TTimeStamp encapsulates seconds and ns since EPOCH

 This extends (and isolates) struct timespec
    struct timespec
       {
          time_t   tv_sec;   /* seconds *
          long     tv_nsec;  /* nanoseconds *
       }
    time_t seconds is relative to Jan 1, 1970 00:00:00 UTC

 No accounting of leap seconds is made.

 Due to ROOT/CINT limitations TTimeStamp does not explicitly
 hold a timespec struct; attempting to do so means the Streamer
 must be hand written.  Instead we have chosen to simply contain
 similar fields within the private area of this class.

 NOTE: the use of time_t (and its default implementation as a 32 int)
       implies overflow conditions occurs somewhere around
       Jan 18, 19:14:07, 2038.
       If this experiment is still going when it becomes significant
       someone will have to deal with it.


Function Members (Methods)

public:
virtual~TTimeStamp()
voidAdd(const TTimeStamp& offset)
Double_tAsDouble() const
Double_tAsGAST(Double_t UT1Offset = 0) const
Double_tAsGMST(Double_t UT1Offset = 0) const
Double_tAsJulianDate() const
Double_tAsLAST(Double_t Longitude, Double_t UT1Offset = 0) const
Double_tAsLMST(Double_t Longitude, Double_t UT1Offset = 0) const
const char*AsString(const Option_t* option = "") const
static TClass*Class()
voidCopy(TTimeStamp& ts) const
static voidDumpTMStruct(const tm_t& tmstruct)
UInt_tGetDate(Bool_t inUTC = kTRUE, Int_t secOffset = 0, UInt_t* year = 0, UInt_t* month = 0, UInt_t* day = 0) const
Int_tGetDayOfWeek(Bool_t inUTC = kTRUE, Int_t secOffset = 0) const
static Int_tGetDayOfWeek(Int_t day, Int_t month, Int_t year)
Int_tGetDayOfYear(Bool_t inUTC = kTRUE, Int_t secOffset = 0) const
static Int_tGetDayOfYear(Int_t day, Int_t month, Int_t year)
Int_tGetMonth(Bool_t inUTC = kTRUE, Int_t secOffset = 0) const
Int_tGetNanoSec() const
time_tGetSec() const
UInt_tGetTime(Bool_t inUTC = kTRUE, Int_t secOffset = 0, UInt_t* hour = 0, UInt_t* min = 0, UInt_t* sec = 0) const
timespec_tGetTimeSpec() const
Int_tGetWeek(Bool_t inUTC = kTRUE, Int_t secOffset = 0) const
static Int_tGetWeek(Int_t day, Int_t month, Int_t year)
static Int_tGetZoneOffset()
virtual TClass*IsA() const
static Bool_tIsLeapYear(Int_t year)
Bool_tIsLeapYear(Bool_t inUTC = kTRUE, Int_t secOffset = 0) const
static time_tMktimeFromUTC(tm_t* tmstruct)
doubleoperator double() const
TTimeStamp&operator=(const TTimeStamp&)
voidPrint(const Option_t* option = "") const
voidSet()
voidSet(UInt_t tloc, Bool_t isUTC, Int_t secOffset, Bool_t dosDate)
voidSet(Int_t date, Int_t time, Int_t nsec, Bool_t isUTC, Int_t secOffset)
voidSet(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)
voidSetNanoSec(Int_t nsec)
voidSetSec(Int_t sec)
virtual voidShowMembers(TMemberInspector& insp) const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
TTimeStamp()
TTimeStamp(const timespec_t& ts)
TTimeStamp(const TTimeStamp&)
TTimeStamp(time_t t, Int_t nsec)
TTimeStamp(UInt_t tloc, Bool_t isUTC = kTRUE, Int_t secOffset = 0, Bool_t dosDate = kFALSE)
TTimeStamp(UInt_t date, UInt_t time, UInt_t nsec, Bool_t isUTC = kTRUE, Int_t secOffset = 0)
TTimeStamp(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)
private:
voidNormalizeNanoSec()

Data Members

private:
Int_tfNanoSecnanoseconds
Int_tfSecseconds

Class Charts

Inheritance Chart:
TTimeStamp

Function documentation

void NormalizeNanoSec()
TTimeStamp()
 empty ctor (builds current time with nsec field incremented from static)
TTimeStamp(const timespec_t& ts)
 construction from timespec struct
TTimeStamp(time_t t, Int_t nsec)
 construction from time_t and separate nsec
TTimeStamp(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)
 construction from bits and pieces
TTimeStamp(UInt_t tloc, Bool_t isUTC = kTRUE, Int_t secOffset = 0, Bool_t dosDate = kFALSE)
 compatibility with TDatime
 compatability with time() and DOS date
{ }
void Set()
 initialize to current time with nsec field incremented from static
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)
 construction from bits and pieces
void Set(UInt_t tloc, Bool_t isUTC, Int_t secOffset, Bool_t dosDate)
 compatibility with TDatime
 compatability with time() and DOS date
void SetSec(Int_t sec)
 direct setters
{ fSec = sec; }
void SetNanoSec(Int_t nsec)
{ fNanoSec = nsec; }
timespec_t GetTimeSpec() const
time_t GetSec() const
{ return fSec; }
Int_t GetNanoSec() const
{ return fNanoSec; }
Double_t AsDouble() const
{ return fSec + 1e-9 * fNanoSec; }
Double_t AsJulianDate() const
{ return (AsDouble()/86400.0 + 2440587.5); }
Double_t AsGMST(Double_t UT1Offset = 0) const
 return stored time values converted to sidereal time
Double_t AsGAST(Double_t UT1Offset = 0) const
Double_t AsLMST(Double_t Longitude, Double_t UT1Offset = 0) const
Double_t AsLAST(Double_t Longitude, Double_t UT1Offset = 0) const
const char * AsString(const Option_t* option = "") const
void Copy(TTimeStamp& ts) const
UInt_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 GetDayOfYear(Bool_t inUTC = kTRUE, Int_t secOffset = 0) const
Int_t GetDayOfWeek(Bool_t inUTC = kTRUE, Int_t secOffset = 0) const
Int_t GetMonth(Bool_t inUTC = kTRUE, Int_t secOffset = 0) const
Int_t GetWeek(Bool_t inUTC = kTRUE, Int_t secOffset = 0) const
Bool_t IsLeapYear(Bool_t inUTC = kTRUE, Int_t secOffset = 0) const
void Add(const TTimeStamp& offset)
void Print(const Option_t* option = "") const
operator double() const
{ return AsDouble(); }
Int_t GetZoneOffset()
 Utility functions
time_t MktimeFromUTC(tm_t* tmstruct)
void DumpTMStruct(const tm_t& tmstruct)
Int_t GetDayOfYear(Int_t day, Int_t month, Int_t year)
Int_t GetDayOfWeek(Int_t day, Int_t month, Int_t year)
Int_t GetWeek(Int_t day, Int_t month, Int_t year)
Bool_t IsLeapYear(Int_t year)