Re: [ROOT] gStyle->SetTimeOffset

From: Dariusz Miskowiec (D.Miskowiec@gsi.de)
Date: Fri Aug 22 2003 - 10:19:40 MEST


Dear Rene,

In this situation I decided to go for a private investigation.
I found that:

- the change in behavior is between root 3.05/03 and 3.05/04.

- according to release notes of 3.05/04, on 2003-04-08 10:16
   "* graf/src/TGaxis.cxx, hist/src/TAxis.cxx:
    The time offset is now saved in fTimeFormat in TAxis and TGaxis (by Olivier)"

- fTimeFormat is a string, like 09/12/99 12:34:00
   TDatime is used to convert from EPOCH seconds to this string

- TDatime does not work for dates older than 1995:
   root [1] TDatime x(7.88918400000000000e+08)
   root [2] x.AsSQLString()
   (const char* 0x40501e48)"1995-01-01 01:00:00"
   root [9] TDatime x(7.88918400000000000e+08-3601)
   root [10] x.AsSQLString()
   (const char* 0x40501e48)"2058-12-31 23:59:59"

and thus the numbers go bananas when one tries any offset
before 1995.

There are many ways to fix it. I personally would propose to
remove all references to the 1995. I think introducing this
magic date, in addition to the standard UNIX magic date 1970,
was not a good idea in the first place.

Best regards
Dariusz

Rene Brun wrote:
> TDatime is based on the Unix time on Unix systems. There are various setters
> (see the class doc).
> The changes by Olivier are posterior to 3.05/05. Use 3.05/07.
> Please communicate with Olivier Couet for further exchanges on this question.
> Olivier will be back at work the first week of September.
> 
> Rene Brun
> 
> Dariusz Miskowiec wrote:
> 
>>Dear Rene,
>>
>>Many thanks for this recommendation. However, the variable
>>I want to display is the standard UNIX time, i.e. the time
>>offset I should use is exactly 0. I do not think it helps
>>if I generate this zero via TDatime(1970,01,01,00,00,00),
>>excuse me, this even cannot be done at all because TDatime
>>does not accept such early dates. So I insist: root 3.05/05
>>behaves differently from older versions (3.03/07), and in
>>particular seems to have a problem with time offsets before
>>1996. It looks to me like it uses internally TDatime for
>>some reason.
>>
>>Naively I would think that plotting things versus standard
>>UNIX time is one of the main applications of the time display
>>feature and thus I am a little surprised that I am having
>>all this trouble...
>>
>>Best regards
>>Dariusz Miskowiec
>>
>>Rene Brun wrote:
>>
>>>Hi Dariusz,
>>>
>>>You should set the time offset with a statement like
>>>  TDatime t;
>>>  gStyle->SetTimeOffset(t.Convert());
>>>
>>>see examples at : http://root.cern.ch/root/HowtoTimeAxis.html
>>>
>>>Olivier Couet has made several improvements in the time axis
>>>in the recent releases. see the above URL for more details.
>>>
>>>Rene Brun
>>>
>>>On Thu, 21
>>>Aug 2003,
>>>Dariusz Miskowiec wrote:
>>>
>>>
>>>
>>>>Dear Rooters,
>>>>
>>>>It seems that
>>>>
>>>>gStyle->SetTimeOffset(0);
>>>>hi=new TH1F("nic","nic",10,0,1e8);
>>>>hi->GetXaxis()->SetTimeDisplay(1);
>>>>hi->GetXaxis()->SetTimeFormat("%y:%m:%d");
>>>>hi->Draw();
>>>>
>>>>produces very different numbers on the horizontal axis when
>>>>ran with root 3.03/07 and 3.05/05 on CERN lxplus. The newer
>>>>root version gives a wrong result.
>>>>
>>>>Best regards
>>>>Dariusz Miskowiec
>>>>
>>>>
>>
>>--
>>+-----------------------------------------------------------------+
>>+  Dariusz Miskowiec                  E-mail: D.Miskowiec@gsi.de  +
>>+  GSI, Planckstr. 1                  Phone:  0049-6159-712-133   +
>>+  D-64291 Darmstadt                  Fax:    0049-6159-712-989   +
>>+-----------------------------------------------------------------+


-- 
+-----------------------------------------------------------------+
+  Dariusz Miskowiec                  E-mail: D.Miskowiec@gsi.de  +
+  GSI, Planckstr. 1                  Phone:  0049-6159-712-133   +
+  D-64291 Darmstadt                  Fax:    0049-6159-712-989   +
+-----------------------------------------------------------------+



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:15 MET