Hi Jon, I got the same problem and solved it by introducing my own class TUnixTime. In your case: TUnixTime tut; tut.SetGTime(idate,itime) time_t ut = tut.GetUTime(); where idate and itime obtained from TDatime. This class allows all conversion between GMT, local and Idate/Itime You can get this class from: if afs: /afs/rhic/star/packages/.DEV/StRoot/StarRoot/* or http://www.rhic.bnl.gov/~perev/StarRoot Victor Jon Gans wrote: > > Hello rooters, > > I have a TDatime that is already in GMT and when I call > convert it likes to think its in Eastern time and convert it to GMT > again. I do not want to reconvert times over again, especially > because of the double value problem durring the daylight savings time > switch. > > Is there away to have TDatime::Convert() not think its current timezone is > eastern (or the system time zone) and always think its in GMT, without > chaning clocks. Can eventually a memeber function be added to set > current offset from GMT. Id rather not have to mess with anything gobal > that could cause havoc on other code. > > Example: > TDatime jon; > jon.Set(2001,12,6,10,30,30); > jon.AsSQLString() ==> "2001-12-06 10:49:44" > cout << "time = " << jon.Convert() << endl; ==> time = 1007652630 > > in SQL: > select from_unixtime(1007652630) from Nodes; > > +---------------------------+ > | from_unixtime(1007652630) | > +---------------------------+ > | 2001-12-06 15:30:30 | > > Thanks alot > Jon -- Victor M. Perevoztchikov perev@bnl.gov perev@vxcern.cern.ch Brookhaven National Laboratory MS 510A PO Box 5000 Upton NY 11973-5000 tel office : 631-344-7894; fax 631-344-4206; home 631-345-2690
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:11 MET