13 const std::vector<std::string>
KVDatime::fNumToMonth = {
"JAN",
"FEB",
"MAR",
"APR",
"MAY",
"JUN",
"JUL",
"AUG",
"SEP",
"OCT",
"NOV",
"DEC"};
40 "Unrecognised month in date (%s)",
Month);
214 sscanf(DateString,
"%4d-%02d-%02d %02d:%02d:%02d",
215 &Y, &M, &D, &
h, &
m, &s);
216 Set(Y, M, D,
h,
m, s);
233 sscanf(DateString,
"%4d-%02d-%02d-%02d.%02d",
236 Set(Y, M, D,
h,
m, s);
253 sscanf(DateString,
"%4d-%02d-%02d.%02d:%02d",
256 Set(Y, M, D,
h,
m, s);
268 sscanf(DMYString,
"%2d/%2d/%4d", &D, &M, &Y);
269 Set(Y, M, D, 0, 0, 0);
289 if (sscanf(tmp.
Data(),
"%02d%3s%02d %02dH%02dM%02dS", &D,
Month, &Y, &
H, &M, &
S) == 6)
294 Set(Y, *imonth, D,
H, M,
S);
313 if (sscanf(tmp.
Data(),
"%02d-%02d-%02d %02dH%02dM%02dS", &D, &
Month, &Y, &
H, &M, &
S) == 6) {
346 "Format is incorrect: %s (should be like \"29-SEP-2005 09:42:17.00\" or \"29-SEP-05 09:42:17\")",
362 (year < 82 ? year += 2000 : year += 1900);
367 Set(year, *month, day, hour,
min, sec);
380 return Form(
"%d-%s-%4d %02d:%02d:%02d.00",
390 return Form(
"%02d/%02d/%4d",
444 return (nelem > 5 && nelem < 8);
463 if (sscanf(tmp.
Data(),
"%02d%3s%02d %02dH%02dM%02dS", &D,
Month, &Y, &
H, &M, &
S) == 6)
483 if (sscanf(tmp.
Data(),
"%02d-%02d-%02d %02dH%02dM%02dS", &D, &
Month, &Y, &
H, &M, &
S) == 6)
500 if (sscanf(date,
"%4d-%02d-%02d %02d:%02d:%02d",
501 &Y, &M, &D, &
h, &
m, &s) != 6)
return kFALSE;
517 if (sscanf(date,
"%4d-%02d-%02d-%02d.%02d",
518 &Y, &M, &D, &
h, &
m) != 5)
return kFALSE;
534 if (sscanf(date,
"%4d-%02d-%02d.%02d:%02d",
535 &Y, &M, &D, &
h, &
m) != 5)
return kFALSE;
558 year_ins -= ref_year;
564 total_ins += year_ins;
568 month_ins *= 365.25 / 12;
573 total_ins += month_ins;
char * Form(const char *fmt,...)
Extension of TDatime to handle various useful date formats.
static const Char_t * Month(Int_t m)
Double_t GetNumberOfSeconds(Int_t ref_year=0)
void SetDMYDate(const Char_t *DMYString)
Set date from string in format "DD/MM/YYYY".
void SetIRODSDate(const Char_t *IRODSDateString)
static std::unordered_map< std::string, int > fMonthToNum
map month name to number
static Bool_t IsGANACQFormat(const Char_t *date)
static const std::vector< std::string > fNumToMonth
map month number to name
static Bool_t IsSRBFormat(const Char_t *date)
TString fStr
internal buffer used by String method
const Char_t * String(EKVDateFormat fmt=kCTIME)
void init_month_map()
set up static map of month names to month numbers if needed
static Bool_t IsSQLFormat(const Char_t *date)
static Bool_t IsGANACQ2010Format(const Char_t *date)
void SetSQLDate(const Char_t *SQLDateString)
void SetGanacqNarvalDate(const Char_t *GanacqDateString)
const Char_t * AsDMYDateString() const
KVDatime & operator=(const KVDatime &)
copy assignment operator
const Char_t * AsGanacqDateString() const
std::optional< int > get_month_from_name(const char *)
void SetSRBDate(const Char_t *SRBDateString)
static Bool_t IsGANACQNarvalFormat(const Char_t *date)
static Bool_t IsIRODSFormat(const Char_t *date)
void SetGanacq2010Date(const Char_t *GanacqDateString)
Double_t GetDureeInSeconds(KVDatime from)
void SetGanacqDate(const Char_t *GanacqDateString)
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
void Begin(TString delim) const
KVString Next(Bool_t strip_whitespace=kFALSE) const
Int_t GetNValues(TString delim) const
const char * AsSQLString() const
TDatime & operator=(const TDatime &d)
const char * AsString() const
const char * Data() const
TString & ReplaceAll(const char *s1, const char *s2)
void Error(UserClass p, const char *location, const char *va_(fmt),...)
RooArgSet S(Args_t &&... args)
double min(double x, double y)