RE: [ROOT] TDatime

From: LEE, KERRY T. (JSC-SR) (UHCL) (kerry.t.lee1@jsc.nasa.gov)
Date: Tue Jul 08 2003 - 23:59:17 MEST


I thought about that being the case, but the default of Convert is
Convert(Bool_t kFALSE), so that the appropriate time zone result is
returned.  Below I do the same conversion but with Convert(kTRUE) and this
gives a result with 0.5 days extra.

root [0] TDatime *da = new TDatime(1995,1,1,0,0,0);
root [1] UInt_t a = da->Convert();
root [2] a
(unsigned int)788940000
root [3] UInt_t a = da->Convert(kTRUE);
root [4] a
(unsigned int)788961600
root [5] Double_t b = (Double_t)a;
root [6] Double_t days = b/3600/24;
root [7] days
(Double_t)9.13150000000000000e+03
root [8]

Any ideas?

Kerry

-----Original Message-----
From: Yiqun Wang
To: LEE, KERRY T. (JSC-SR) (UHCL)
Sent: 7/8/2003 4:39 PM
Subject: Re: [ROOT] TDatime

>From ROOT manual:

UInt_t Convert(Bool_t toGMT) const

 Convert fDatime from TDatime format to the standard time_t format.
 If toGMT is true the returned time_t is converted to GMT.

What about time zone? It looks like your result is 0.25 day from an
integer.
That could be just 6 hours of time zone effect.

My 2 cents,

yiqun wang

> Dear Root team,
>
> I am using ROOT 3.05.05 on Red Hat 9 gcc3.2.2.
>
> I think there is an error in the TDatime::Convert() function.  I
expect
> the Convert function
> to return the number of seconds since Jan 1, 1970 at 0:0:0 therefore
the
> result divided by 86,400 (number of seconds per day) should be an
> integer for a time 0:0:0 any other day.  Below I put in Jan 1, 1995
> 0:0:0, so I expect the result to be (25years*365days/year+6leap
> days)*86400sec/day = 788918400, but the result differs by 0.25 days.
Is
> this expected?
>
> root [0] TDatime *da = new TDatime(1995,1,1,0,0,0);
> root [1] UInt_t a = da->Convert();
> root [2] a
> (unsigned int)788940000
> root [3] Double_t b = (Double_t)a;
> root [4] Double_t days = b/3600/24;
> root [5] days
> (Double_t)9.13125000000000000e+03
> root [6]
>
> Thanks
> Kerry



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