KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
KVDatime Class Reference

Extension of TDatime to handle various useful date formats.

This class can 'read' and 'write' date and timestamps in many different formats:

Definition at line 32 of file 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)
 
virtual ~ KVDatime ()
 
const Char_tAsDMYDateString () const
 
const Char_tAsGanacqDateString () const
 
Double_t GetDureeInSeconds (KVDatime from)
 
Double_t GetNumberOfSeconds (Int_t ref_year=0)
 
KVDatimeoperator= (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_tString (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
 
TDatimeoperator= (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
 

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_tMonth (Int_t m)
 
- Static Public Member Functions inherited from TDatime
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

void init ()
 

Private Attributes

TString fStr
 internal buffer used by String method More...
 

Static Private Attributes

static KVListfmonths = 0
 list of months More...
 
static Int_t ndatime = 0
 counter More...
 

Additional Inherited Members

- Protected Attributes inherited from TDatime
UInt_t fDatime
 

#include <KVDatime.h>

Inheritance diagram for KVDatime:
Inheritance graph
[legend]

Member Enumeration Documentation

◆ EKVDateFormat

Enumerator
kCTIME 
kGANACQ 
kSQL 
kSRB 
kIRODS 
kDMY 
kGANACQ2010 
kGANACQNarval 

Definition at line 40 of file KVDatime.h.

Constructor & Destructor Documentation

◆ KVDatime() [1/7]

KVDatime::KVDatime ( )

Definition at line 52 of file KVDatime.cpp.

◆ KVDatime() [2/7]

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 102 of file KVDatime.cpp.

◆ KVDatime() [3/7]

KVDatime::KVDatime ( const KVDatime d)
inline

Definition at line 53 of file KVDatime.h.

◆ KVDatime() [4/7]

KVDatime::KVDatime ( const TDatime d)
inline

Definition at line 59 of file KVDatime.h.

◆ KVDatime() [5/7]

KVDatime::KVDatime ( UInt_t  tloc,
Bool_t  dosDate = kFALSE 
)
inline

Definition at line 64 of file KVDatime.h.

◆ KVDatime() [6/7]

KVDatime::KVDatime ( Int_t  date,
Int_t  time 
)
inline

Definition at line 69 of file KVDatime.h.

◆ KVDatime() [7/7]

KVDatime::KVDatime ( Int_t  year,
Int_t  month,
Int_t  day,
Int_t  hour,
Int_t  min,
Int_t  sec 
)
inline

Definition at line 74 of file KVDatime.h.

◆ ~ KVDatime()

virtual KVDatime::~ KVDatime ( )
virtual

Member Function Documentation

◆ AsDMYDateString()

const Char_t * KVDatime::AsDMYDateString ( ) const

Definition at line 385 of file KVDatime.cpp.

◆ AsGanacqDateString()

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 371 of file KVDatime.cpp.

◆ GetDureeInSeconds()

Double_t KVDatime::GetDureeInSeconds ( KVDatime  from)

Definition at line 590 of file KVDatime.cpp.

◆ GetNumberOfSeconds()

Double_t KVDatime::GetNumberOfSeconds ( Int_t  ref_year = 0)

Definition at line 554 of file KVDatime.cpp.

◆ init()

void KVDatime::init ( void  )
private

called by all ctors sets up static list of months' names if not already done

Definition at line 25 of file KVDatime.cpp.

◆ IsGANACQ2010Format()

Bool_t KVDatime::IsGANACQ2010Format ( const Char_t date)
static

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 455 of file KVDatime.cpp.

◆ IsGANACQFormat()

Bool_t KVDatime::IsGANACQFormat ( const Char_t date)
static

Static method, returns kTRUE if 'date' is in format of GANIL acquisition e.g. 29-SEP-2005 09:42:17.00

Definition at line 433 of file KVDatime.cpp.

◆ IsGANACQNarvalFormat()

Bool_t KVDatime::IsGANACQNarvalFormat ( const Char_t date)
static

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 476 of file KVDatime.cpp.

◆ IsIRODSFormat()

Bool_t KVDatime::IsIRODSFormat ( const Char_t date)
static

Static method, returns kTRUE if 'date' is in IRODS format e.g. 2008-12-19.15:21

Definition at line 530 of file KVDatime.cpp.

◆ IsSQLFormat()

Bool_t KVDatime::IsSQLFormat ( const Char_t date)
static

Static method, returns kTRUE if 'date' is in SQL format e.g. 2007-05-02 14:52:18

Definition at line 496 of file KVDatime.cpp.

◆ IsSRBFormat()

Bool_t KVDatime::IsSRBFormat ( const Char_t date)
static

Static method, returns kTRUE if 'date' is in SRB format e.g. 2008-12-19-15.21

Definition at line 513 of file KVDatime.cpp.

◆ Month()

const Char_t * KVDatime::Month ( Int_t  m)
static

Definition at line 545 of file KVDatime.cpp.

◆ operator=()

KVDatime & KVDatime::operator= ( const KVDatime d)

copy assignment operator

Definition at line 179 of file KVDatime.cpp.

◆ SetDMYDate()

void KVDatime::SetDMYDate ( const Char_t DMYString)

Set date from string in format "DD/MM/YYYY".

Definition at line 259 of file KVDatime.cpp.

◆ SetGanacq2010Date()

void KVDatime::SetGanacq2010Date ( const Char_t GanacqDateString)

Decodes dates in new (2010) format of GANIL acquisition run files, e.g. run_0058.dat.27Nov10_02h07m40s

Definition at line 273 of file KVDatime.cpp.

◆ SetGanacqDate()

void KVDatime::SetGanacqDate ( const Char_t GanacqDateString)

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 323 of file KVDatime.cpp.

◆ SetGanacqNarvalDate()

void KVDatime::SetGanacqNarvalDate ( const Char_t GanacqDateString)

Decodes dates in format of GANIL Narval acquisition run files, e.g. run_0058.dat.27-11-10_02h07m40s

Definition at line 297 of file KVDatime.cpp.

◆ SetIRODSDate()

void KVDatime::SetIRODSDate ( const Char_t DateString)

Decodes IRODS format date into a TDatime Format of date string is: 2008-12-19.15:21

Definition at line 241 of file KVDatime.cpp.

◆ SetSQLDate()

void KVDatime::SetSQLDate ( const Char_t DateString)

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 204 of file KVDatime.cpp.

◆ SetSRBDate()

void KVDatime::SetSRBDate ( const Char_t DateString)

Decodes SRB format date into a TDatime Format of date string is: 2008-12-19-15.21

Definition at line 221 of file KVDatime.cpp.

◆ String()

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 401 of file KVDatime.cpp.

Member Data Documentation

◆ fmonths

KVList * KVDatime::fmonths = 0
staticprivate

list of months

Definition at line 33 of file KVDatime.h.

◆ fStr

TString KVDatime::fStr
private

internal buffer used by String method

Definition at line 36 of file KVDatime.h.

◆ ndatime

Int_t KVDatime::ndatime = 0
staticprivate

counter

Definition at line 34 of file KVDatime.h.


The documentation for this class was generated from the following files: