Re: Wrong year displayed with time on a TGraph axis

From: Brett Viren <bv_at_bnl.gov>
Date: Mon, 07 Mar 2005 12:43:28 -0500


Olivier Couet <couet_at_mail.cern.ch> writes:

> For me the command:
>
> gStyle->SetTimeOffset(0);
>
> is still needed to have the correct year (2005) in that macro.

Yes, I confirm. I had tested my old macro in the same session after running yours so the gStyle->SetTimeOffset(0) was still in effect. A new session w/out this reverts to showing year 2030.

> Ho, I see your point now. I guess that is ok because the SetTimeFormat %F
> control is the first one found when scanning from the end of the string so
> if there is one before it should be fine.

Unless the user wants a format such that strftime's %F is the first found. For eg. in your timeonaxis4.C if I simply use:

   axis->SetTimeFormat("%F");

I get:

Error in <TGaxis::PaintAxis>: Time offset has not the right format

And it shows times like "25-15h".

Anyways, this isn't a big deal since strftime's %F is just shorthand for %Y-%m-%d. But, it may be worth noting in the docs. Ie something like.

    This function allows also to define the time offset. It is done     via %F which should be appended at the end of the format string.     (Note: to get strftime's %F functionality explicitly use     %Y-%m-%d).

Thanks for the gStyle->SetTimeOffset(0) workaround, -Brett. Received on Mon Mar 07 2005 - 18:43:52 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:05 MET