![]() |
KaliVeda
Toolkit for HIC analysis
|
Extension of TDatime to handle various useful date formats.
This class can 'read' and 'write' date and timestamps in many different formats:
29-SEP-2005 09:42:17.0027Nov10_02h07m40s12-04-18_17h09m41s2007-05-02 14:52:182008-12-19-15.212008-12-19.15:2119/12/2008 Definition at line 34 of file KVDatime.h.
#include <KVDatime.h>

Public Types | |
| enum | EKVDateFormat { kCTIME , kGANACQ , kSQL , kSRB , kIRODS , kDMY , kGANACQ2010 , kGANACQNarval } |
Public Member Functions | |
| KVDatime () | |
| KVDatime (const Char_t *DateString, EKVDateFormat f=kGANACQ) | |
| KVDatime (const KVDatime &d) | |
| KVDatime (const TDatime &d) | |
| KVDatime (Int_t date, Int_t time) | |
| KVDatime (Int_t year, Int_t month, Int_t day, Int_t hour, Int_t min, Int_t sec) | |
| KVDatime (UInt_t tloc, Bool_t dosDate=kFALSE) | |
| const Char_t * | AsDMYDateString () const |
| const Char_t * | AsGanacqDateString () const |
| Double_t | GetDureeInSeconds (KVDatime from) |
| Double_t | GetNumberOfSeconds (Int_t ref_year=0) |
| KVDatime & | operator= (const KVDatime &) |
| copy assignment operator More... | |
| void | SetDMYDate (const Char_t *DMYString) |
| Set date from string in format "DD/MM/YYYY". More... | |
| void | SetGanacq2010Date (const Char_t *GanacqDateString) |
| void | SetGanacqDate (const Char_t *GanacqDateString) |
| void | SetGanacqNarvalDate (const Char_t *GanacqDateString) |
| void | SetIRODSDate (const Char_t *IRODSDateString) |
| void | SetSQLDate (const Char_t *SQLDateString) |
| void | SetSRBDate (const Char_t *SRBDateString) |
| const Char_t * | String (EKVDateFormat fmt=kCTIME) |
Public Member Functions inherited from TDatime | |
| TDatime () | |
| TDatime (const char *sqlDateTime) | |
| TDatime (const TDatime &d) | |
| TDatime (Int_t date, Int_t time) | |
| TDatime (Int_t year, Int_t month, Int_t day, Int_t hour, Int_t min, Int_t sec) | |
| TDatime (UInt_t tloc, Bool_t dosDate=kFALSE) | |
| virtual | ~TDatime () |
| const char * | AsSQLString () const |
| const char * | AsString () const |
| const char * | AsString (char *out) const |
| UInt_t | Convert (Bool_t toGMT=kFALSE) const |
| void | Copy (TDatime &datime) const |
| void | FillBuffer (char *&buffer) |
| UInt_t | Get () const |
| Int_t | GetDate () const |
| Int_t | GetDay () const |
| Int_t | GetDayOfWeek () const |
| Int_t | GetHour () const |
| Int_t | GetMinute () const |
| Int_t | GetMonth () const |
| Int_t | GetSecond () const |
| Int_t | GetTime () const |
| Int_t | GetYear () const |
| virtual TClass * | IsA () const |
| TDatime & | operator= (const TDatime &d) |
| void | Print (Option_t *option="") const |
| void | ReadBuffer (char *&buffer) |
| void | Set () |
| void | Set (const char *sqlDateTime) |
| void | Set (Int_t date, Int_t time) |
| void | Set (Int_t year, Int_t month, Int_t day, Int_t hour, Int_t min, Int_t sec) |
| void | Set (UInt_t tloc, Bool_t dosDate=kFALSE) |
| Int_t | Sizeof () const |
| virtual void | Streamer (TBuffer &) |
| void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
Static Public Member Functions | |
| static Bool_t | IsGANACQ2010Format (const Char_t *date) |
| static Bool_t | IsGANACQFormat (const Char_t *date) |
| static Bool_t | IsGANACQNarvalFormat (const Char_t *date) |
| static Bool_t | IsIRODSFormat (const Char_t *date) |
| static Bool_t | IsSQLFormat (const Char_t *date) |
| static Bool_t | IsSRBFormat (const Char_t *date) |
| static const Char_t * | Month (Int_t m) |
Static Public Member Functions inherited from TDatime | |
| static TClass * | Class () |
| static const char * | Class_Name () |
| static constexpr Version_t | Class_Version () |
| static const char * | DeclFileName () |
| static Int_t | GetDateFromGlobalDay (Int_t day) |
| static void | GetDateTime (UInt_t datetime, Int_t &date, Int_t &time) |
| static Int_t | GetGlobalDayFromDate (Int_t date) |
| static Int_t | GetLegalGlobalDayFromDate (Int_t date) |
Private Member Functions | |
| std::optional< int > | get_month_from_name (const char *) |
| void | init_month_map () |
| set up static map of month names to month numbers if needed More... | |
Private Attributes | |
| TString | fStr |
| internal buffer used by String method More... | |
Static Private Attributes | |
| static std::unordered_map< std::string, int > | fMonthToNum |
| map month name to number More... | |
| static const std::vector< std::string > | fNumToMonth = {"JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"} |
| map month number to name More... | |
Additional Inherited Members | |
Protected Attributes inherited from TDatime | |
| UInt_t | fDatime |
| Enumerator | |
|---|---|
| kCTIME | |
| kGANACQ | |
| kSQL | |
| kSRB | |
| kIRODS | |
| kDMY | |
| kGANACQ2010 | |
| kGANACQNarval | |
Definition at line 45 of file KVDatime.h.
| KVDatime::KVDatime | ( | ) |
Definition at line 50 of file KVDatime.cpp.
| KVDatime::KVDatime | ( | const Char_t * | DateString, |
| EKVDateFormat | f = kGANACQ |
||
| ) |
if f = KVDatime::kGANACQ:
Decodes GANIL acquisition (INDRA) run-sheet format date into a TDatime
Format of date string is: 29-SEP-2005 09:42:17.00
if f = KVDatime::kGANACQ2010:
Decodes GANIL acquisition runfile format date into a TDatime
Format of date string is: 27Nov10_02h07m40s
if f = KVDatime::kGANACQNarval:
Decodes GANIL Narval acquisition runfile format date into a TDatime
Format of date string is: 12-04-18_17h09m41s
if f = KVDatime::kSQL:
Decodes SQL format date into a TDatime (i.e. same format as returned by TDatime::AsSQLString(): 2007-05-02 14:52:18)
if f = KVDatime::kSRB:
Decodes SRB format date into a TDatime
Format of date string is: 2008-12-19-15.21
if f = KVDatime::kIRODS:
Decodes IRODS format date into a TDatime
Format of date string is: 2008-12-19.15:21
if f = KVDatime::kDMY:
Decodes DMY format date into a TDatime
Format of date string is: 19/12/2008
Definition at line 99 of file KVDatime.cpp.
| KVDatime::KVDatime | ( | const KVDatime & | d | ) |
Definition at line 173 of file KVDatime.cpp.
| KVDatime::KVDatime | ( | const TDatime & | d | ) |
Definition at line 177 of file KVDatime.cpp.
Definition at line 181 of file KVDatime.cpp.
Definition at line 185 of file KVDatime.cpp.
Definition at line 189 of file KVDatime.cpp.
| const Char_t * KVDatime::AsDMYDateString | ( | ) | const |
Definition at line 388 of file KVDatime.cpp.
| const Char_t * KVDatime::AsGanacqDateString | ( | ) | const |
Return date and time string with format "29-SEP-2005 09:42:17.00" Copy the string immediately if you want to reuse/keep it
Definition at line 376 of file KVDatime.cpp.
|
private |
Definition at line 35 of file KVDatime.cpp.
Definition at line 588 of file KVDatime.cpp.
Definition at line 552 of file KVDatime.cpp.
|
private |
set up static map of month names to month numbers if needed
Definition at line 20 of file KVDatime.cpp.
Static method, returns kTRUE if 'date' is in new (2010) format of GANIL acquisition run files, e.g. run_0058.dat.27Nov10_02h07m40s
Definition at line 453 of file KVDatime.cpp.
Static method, returns kTRUE if 'date' is in format of GANIL acquisition e.g. 29-SEP-2005 09:42:17.00
Definition at line 436 of file KVDatime.cpp.
Static method, returns kTRUE if 'date' is in format of GANIL Narval acquisition run files, e.g. run_0058.dat.27-11-10_02h07m40s
Definition at line 474 of file KVDatime.cpp.
Static method, returns kTRUE if 'date' is in IRODS format e.g. 2008-12-19.15:21
Definition at line 528 of file KVDatime.cpp.
Static method, returns kTRUE if 'date' is in SQL format e.g. 2007-05-02 14:52:18
Definition at line 494 of file KVDatime.cpp.
Static method, returns kTRUE if 'date' is in SRB format e.g. 2008-12-19-15.21
Definition at line 511 of file KVDatime.cpp.
Definition at line 543 of file KVDatime.cpp.
copy assignment operator
Definition at line 197 of file KVDatime.cpp.
Set date from string in format "DD/MM/YYYY".
Definition at line 264 of file KVDatime.cpp.
Decodes dates in new (2010) format of GANIL acquisition run files, e.g. run_0058.dat.27Nov10_02h07m40s
Definition at line 278 of file KVDatime.cpp.
Decodes GANIL acquisition (INDRA) run-sheet format date into a TDatime Format of date string is: 29-SEP-2005 09:42:17.00 or 29-SEP-2005 09:42:17 or 29-SEP-05 09:42:17.00 or 29-SEP-05 09:42:17
If format is not respected, we set to current time & date
Definition at line 331 of file KVDatime.cpp.
Decodes dates in format of GANIL Narval acquisition run files, e.g. run_0058.dat.27-11-10_02h07m40s
Definition at line 305 of file KVDatime.cpp.
Decodes IRODS format date into a TDatime Format of date string is: 2008-12-19.15:21
Definition at line 246 of file KVDatime.cpp.
Decodes SQL format date into a TDatime (i.e. same format as returned by TDatime::AsSQLString(): "2007-05-02 14:52:18")
Definition at line 209 of file KVDatime.cpp.
Decodes SRB format date into a TDatime Format of date string is: 2008-12-19-15.21
Definition at line 226 of file KVDatime.cpp.
| const Char_t * KVDatime::String | ( | EKVDateFormat | fmt = kCTIME | ) |
Returns date & time as a string in required format: fmt = kCTIME (default) : ctime format e.g. Thu Apr 10 10:48:34 2008 fmt = kSQL : SQL format e.g. 1997-01-15 20:16:28 fmt = kGANACQ : GANIL acquisition format e.g. 29-SEP-2005 09:42:17.00 fmt = kDMY : DD/MM/YYYY
Definition at line 404 of file KVDatime.cpp.
|
staticprivate |
map month name to number
Definition at line 37 of file KVDatime.h.
|
staticprivate |
map month number to name
Definition at line 36 of file KVDatime.h.
|
private |
internal buffer used by String method
Definition at line 38 of file KVDatime.h.