Re: [ROOT] TDatime and GMT

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Tue Jan 22 2002 - 16:06:35 MET


Hi Hermann-Josef,

  if you want to store non localtime you've to explicitely set
the date/time in the TDatime ctor. The convert to GMT is based
on the TZ setting of your machine. TDatime has second precision
and was written to be as compact as possible (one int). However,
since there is a lot of interest for a general TTimeStamp class
with higher precision and all conversion possibilities I would
propose to adopt Robert Hatchers TTimeStamp class for this.

Remains the POSIX/leap second issue.


Cheers, Fons.



On Tue, 2002-01-22 at 15:27, mathes@ik.fzk.de wrote:
> Hi Rooters,
> 
> I have a problem in deciding if TDatime is a useful class for me. I have
> seen that there was already a thread concerning a similar issue in this
> mailing list (http://root.cern.ch/root/roottalk/roottalk01/4470.html),
> but the problem is not yet fixed (for me).
> 
> As far as I understood the TDatime.cxx code, the internal representation
> in TDatime is related to the date/time in the local time. If one wants to
> exchange data to another time zone (in our case from Argentina (GMT+3) to
> GMT-6 .. GMT+2), even the method Convert(kTRUE) does not give the right
> result, as one has to know always both timezones (?). Wouldn't it be
> better to use the UTC value (possibly shifted by an offset 1970 ->
> 1995) for the internal representation ?
> 
> Or is it better to follow from the beginning the approach of R. Hatcher
> (http://root.cern.ch/root/roottalk/roottalk01/4474.html) prior to extend
> the class TDatime into TNanoDatime ?
> 
> The next confusing point and probably pure academic is that time() doesn't
> return the UTC time, as UTC is officially defined to be the real number of
> seconds since 1.1.1970 UT, INCLUDING the leap seconds which are (according
> to my man-pages, might be wrong) not taken into account in a standard
> (Posix conform implementation) of the time() function.
> 
> Quoting from the man-page:
> time  returns the time since the Epoch (00:00:00 UTC, January 1, 1970), 
> measured in seconds.
> 
> POSIX.1  defines  seconds since the Epoch as a value to be
>        interpreted as the number of seconds between  a  specified
>        time  and the Epoch, according to a formula for conversion
>        from UTC equivalent to conversion on the naive basis  that
>        leap  seconds are ignored and all years divisible by 4 are
>        leap years.
>        ...
>        The intention is
>        that the interpretation of seconds since the Epoch  values
>        be  consistent;  see  POSIX.1  Annex  B  2.2.2 for further
>        rationale.
> ---- end of quote
> 
> Regards and thanks for clarification
>   Hermann-Josef
> 
> **************************************************************************
> *                                                                        *
> *   Dr. Hermann-Josef Mathes                                             *
> *   KASCADE & AUGER Collaboration                                        *
> *   Forschungszentrum Karlsruhe                Phone: +49 7247 822429    *
> *   Institut fuer Kernphysik                   FAX:   +49 7247 824075    *
> *   POB 3640                                                             *
> *   D-76021 Karlsruhe/Germany                  Mail:  mathes@ik.fzk.de   *
> *                                                     hjmathes@web.de    *
> *                                                                        *
> *   Feel free to visit my homepage:                                      *
> *          http://www-ik3.fzk.de/~mathes/Welcome.html                    *
> **************************************************************************
-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:39 MET