diff --git a/hist/hist/inc/TAxis.h b/hist/hist/inc/TAxis.h index f4ea55ea2b30b..d057e6ae13137 100644 --- a/hist/hist/inc/TAxis.h +++ b/hist/hist/inc/TAxis.h @@ -131,6 +131,7 @@ class TAxis : public TNamed, public TAttAxis { virtual Bool_t GetTimeDisplay() const {return fTimeDisplay;} virtual const char *GetTimeFormat() const {return fTimeFormat.Data();} virtual const char *GetTimeFormatOnly() const; + UInt_t GetTimeOffset(); const char *GetTitle() const override {return fTitle.Data();} const TArrayD *GetXbins() const {return &fXbins;} Int_t GetFirst() const; diff --git a/hist/hist/src/TAxis.cxx b/hist/hist/src/TAxis.cxx index a36eb7437eb2c..4e06a49117e99 100644 --- a/hist/hist/src/TAxis.cxx +++ b/hist/hist/src/TAxis.cxx @@ -608,6 +608,26 @@ const char *TAxis::GetTimeFormatOnly() const return timeformat.Data(); } +//////////////////////////////////////////////////////////////////////////////// +/// Return the time offset in GMT. + +UInt_t TAxis::GetTimeOffset() { + + Int_t idF = fTimeFormat.Index("%F")+2; + if (idF<2) { + Warning("GetGMTimeOffset","Time format is not set!"); + return 0; + } + TString stime=fTimeFormat(idF,19); + if (stime.Length() != 19) { + Warning("GetGMTimeOffset","Bad time format!"); + return 0; + } + + TDatime datime(stime.Data()); + return datime.Convert(kTRUE); // Convert to unix gmt time +} + //////////////////////////////////////////////////////////////////////////////// /// Return the ticks option (see SetTicks)