Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement TAxis::GetTimeOffset #13595

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions hist/hist/inc/TAxis.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 20 additions & 0 deletions hist/hist/src/TAxis.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down