Re: [ROOT] TDatime and GMT

From: Christoph Bugel (chris@tti-telecom.com)
Date: Mon Jan 28 2002 - 16:41:33 MET


On Tue 2002-01-22, Fons Rademakers wrote:
> 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.

I don't use ROOT classes, but just out of interest in the subject
I would like to add that in my view the correct (yeah, right)
solution would be a Date class that represents a point in time in
an absolute, zone-independant way (time_t will do), and it will
have methods to show its broken-down fields (year, month, day,
etc) for any given timezone, and it will have constructor to
create itself from broken-down fields + any timezone. So, once a
'Date' object is constructed, its value is absolute (for example,
it should probably hold a time_t plus a milisec as data members)
And the same object can be 'printed' to any timezone the user
likes- the user should *supply* the desired timezone as a
parameter, an therefore the code should *totally* *ignore* the TZ
variable.. (My intial trial involved doing putenv(TZ), which is a
mess, because it affects all other code / threads in the same
process)
We tried to do something like that, using public domain code from
elsie.nci.nih.gov (I think it includes mktime and localtime
implementations), and changing the code so that TZ is not taken
from the environment, but supplied explicitly as a parameter to
those functions.



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