RE: [ROOT] system time in msec ?

From: Faine, Valeri (fine@bnl.gov)
Date: Tue Mar 05 2002 - 20:48:34 MET


Hello 

In theory  (;-)the TStopwatch method is a good ROOT candidate.
Have a look at
 
http://root.cern.ch/root/htmldoc/src/TStopwatch.cxx.html#TStopwatch:GetRealT
ime

         Valeri
-----Original Message-----
From: Robert Hatcher
To: Fons Rademakers
Cc: Joe Robe; roottalk@pcroot.cern.ch
Sent: 3/5/02 12:00 PM
Subject: Re: [ROOT] system time in msec ?

On Tue, 5 Mar 2002, Fons Rademakers wrote:

> Check TTimeStamp.

Well, I'm not sure that this satisfies Joe's needs (any more than
TDatime)
in that while it can handle sub-second precison it doesn't know how to
"get" that info.  the TTimeStamp() ctor constructs a time based on
seconds
since "epoch" (1970-01-01 00:00:00). The default ctor calls Set() which
has:

   // Set Date/Time to current time as reported by the system.
   // No accounting for nanoseconds with std ANSI functions,
   // ns part faked so that subsequent calls simply add 1 to it
   // this ensures that calls within the same second come back
   // distinct (and sortable).

   time_t now;
   time(&now);
   fSec = now;

   static Int_t fake_ns = 0;
   fNanoSec = fake_ns++;

If there are standard ways of determining sub-second times I'd be
interested.  But I know of no means that is consistently available on
all platforms.

-robert

> On Tue, 2002-03-05 at 15:06, Joe Robe wrote:
> > Hi,
> >
> > TTime seems only to be a storage class, and TDatime does only return
current time in sec precision. Any class who returns current time in
msec precision ? Since my app must run on Linux AND windoze I do not
want to implement it by myself ( no clue about Linux).
> >
> > Joe
> >
> --
> 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
>

Robert W. Hatcher   | rhatcher@fnal.gov   630-840-3102
FNAL CD/CP (MINOS)  | MS 220, PO Box 500, Batavia IL 60510



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