Re: TDatime constructors

From: George Heintzelman (gah@bnl.gov)
Date: Fri Oct 15 1999 - 19:24:56 MEST


Rene,

You write:

> You can use the TDatime::Set functions
>    virtual void         Set(Int_t date, Int_t time);
>    virtual void         Set(Int_t year, Int_t month, Int_t day,
>                             Int_t hour, Int_t min, Int_t sec);

> > How come there is no constructor for TDatime which will let you *make*
> > a TDatime object at a specified date and time? I want to be able to do:
> > 
> > if (mytime = TDatime(1995,01,01,00,00,00)) { Do stuff...}

Rene, I am aware that I can use the Set function. 

However, this means that I can't use a temporary unnamed object like in 
my example above; and I can see no reason for NOT supplying such a 
constructor. It seems to be an integral part of a date/time class. 
Also, operator=, operator==, and the greater-than/less-than comparison 
operators would be great. If I want to test for a specific date right 
now, I actually have to go through the Convert() function (or the 
GetDate and GetTime functions) eg:

TDatime temp;
temp.Set(1995,01,01,00,00,00);

if (mytime.Convert() == temp.Convert()) {Do stuff}

versus:

if (mytime == TDatime(1995,01,01,00,00,00)) {Do stuff}

A last request would be, since you have a conversion for going from 
TDatime to time_t, how about a conversion in the other direction?

George Heintzelman



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:41 MET