23TString stime(time_t *t,
bool utc =
false,
bool display_time_zone =
true)
31 if (display_time_zone)
32 strftime(buf,
sizeof(buf),
"%Y-%m-%d %H:%M:%S %Z",
tt);
34 strftime(buf,
sizeof(buf),
"%Y-%m-%d %H:%M:%S",
tt);
61 time_t offset[] = {0, 0, 1325376000, 1341100800};
62 time_t t[] = {1331150400, 1336417200, 0, 36000};
65 c->SetBottomMargin(0);
68 c->Divide(2, 4, -1, -1);
70 l.DrawLine(0.5, 0, 0.5, 1.);
72 for (
int i = 0; i < 4; ++i) {
73 for (
int gmt = 0; gmt < 2; ++gmt) {
74 const char *opt = (gmt ?
"gmt" :
"local");
82 TGaxis *ga =
new TGaxis(.4, .25, 5., .25, t[i], t[i] + 1, 1,
"t");
83 ga->
SetTimeFormat(
"TGaxis label: #color[2]{%Y-%m-%d %H:%M:%S}");
96 TAxis a(10, 0, 1600000000);
97 a.SetTimeOffset(offset[i], opt);
98 const char *offsettimeformat =
a.GetTimeFormat();
101 if (offset[i] < t[i]) {
102 snprintf(buf, 256,
"#splitline{%s, %s}{offset: %ld, option %s}", stime(t + i).Data(),
103 stime(t + i,
true).Data(), offset[i], opt);
106 int m = (t[i] - 3600 *
h) / 60;
107 int s = (t[i] -
h * 3600 -
m * 60);
108 snprintf(buf, 256,
"#splitline{%d h %d m %d s}{offset: %s, option %s}",
h,
m, s,
109 stime(offset + i, gmt).Data(), opt);
112 tex2.
DrawLatex(.01, .50, offsettimeformat);
113 time_t t_ = t[i] + offset[i];
114 snprintf(buf, 256,
"Expecting: #color[2]{%s}", stime(&t_, gmt,
false).Data());
117 l.DrawLine(0, 0.95, 1, 0.95);
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void SetBottomMargin(Float_t bottommargin)
Set Pad bottom margin in fraction of the pad height.
virtual void SetLeftMargin(Float_t leftmargin)
Set Pad left margin in fraction of the pad width.
virtual void SetRightMargin(Float_t rightmargin)
Set Pad right margin in fraction of the pad width.
virtual void SetTopMargin(Float_t topmargin)
Set Pad top margin in fraction of the pad height.
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
Class to manage histogram axis.
void SetTimeFormat(const char *tformat)
void SetLabelFont(Int_t labelfont)
void SetLabelOffset(Float_t labeloffset)
void SetTimeOffset(Double_t toffset, Option_t *option="local")
void SetLabelColor(Int_t labelcolor)
void SetLabelSize(Float_t labelsize)
TLatex * DrawLatex(Double_t x, Double_t y, const char *text)
Use the TLine constructor to create a simple line.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
virtual void SetNDC(Bool_t isNDC=kTRUE)
TVirtualPad is an abstract base class for the Pad and Canvas classes.