Re: [ROOT] TTime enhancement?

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Fri Mar 08 2002 - 15:36:20 MET


Hi Anton,

  if you send the code I'll merge it in.

Cheers, Fons.



On Fri, 2002-03-08 at 15:13, Anton Fokin wrote:
> Hi guys,
> 
> what I would like to see in ROOT is a more humanistic TTime class. Can
> we (I can send a code) add a few functions which allow
> 
> - hold and manipulate with time in terms of seconds passed from midnight
> 
> - take a time string in the constructor
> - etc. I don't want to hurt your feelings but Qt QTime is basically what
> I am looking for :) See attachement...
> 
> Cheers,
> Anton
> 
> ----
> 

> QTime Class Reference
> The QTime class provides clock time functions. More... 
> 
> #include <qdatetime.h> 
> 
> List of all member functions. 
> 
> Public Members
> QTime ()
> QTime ( int h, int m, int s = 0, int ms = 0 )
> bool isNull () const
> bool isValid () const
> int hour () const
> int minute () const
> int second () const
> int msec () const
> QString toString ( Qt::DateFormat f = Qt::TextDate ) const
> QString toString ( const QString & format ) const
> bool setHMS ( int h, int m, int s, int ms = 0 )
> QTime addSecs ( int nsecs ) const
> int secsTo ( const QTime & t ) const
> QTime addMSecs ( int ms ) const
> int msecsTo ( const QTime & t ) const
> bool operator== ( const QTime & t ) const
> bool operator!= ( const QTime & t ) const
> bool operator< ( const QTime & t ) const
> bool operator<= ( const QTime & t ) const
> bool operator> ( const QTime & t ) const
> bool operator>= ( const QTime & t ) const
> void start ()
> int restart ()
> int elapsed () const
> Static Public Members
> QTime currentTime ()
> QTime fromString ( const QString & s, Qt::DateFormat f = Qt::TextDate )
> bool isValid ( int h, int m, int s, int ms = 0 )
> Related Functions
> QDataStream & operator<< ( QDataStream & s, const QTime & t )
> QDataStream & operator>> ( QDataStream & s, QTime & t )
> 
> --------------------------------------------------------------------------------
> 
> Detailed Description
> The QTime class provides clock time functions. 
> 
> 
> A QTime object contains a clock time, i.e. the number of hours, minutes, seconds, and milliseconds since midnight. It can read the current time from the system clock and measure a span of elapsed time. It provides functions for comparing times and for manipulating a time by adding a number of (milli)seconds. 
> 
> QTime operates with 24-hour clock format; it has no concept of AM/PM. It operates in local time; it knows nothing about time zones or daylight savings time. 
> 
> A QTime object is typically created either by giving the number of hours, minutes, seconds, and milliseconds explicitly, or by using the static function currentTime(), which makes a QTime object that contains the system's clock time. Note that the accuracy depends on the accuracy of the underlying operating system; not all systems provide 1-millisecond accuracy. 
> 
> The hour(), minute(), second(), and msec() functions provide access to the number of hours, minutes, seconds, and milliseconds of the time. The same information is provided in textual format by the toString() function. 
> 
> QTime provides a full set of operators to compare two QTime objects. One time is considered smaller than another if it is earlier than the other. 
> 
> The time a given number of seconds or milliseconds later than a given time can be found using the addSecs() or addMSecs() functions. Correspondingly, the number of (milli)seconds between two times can be found using the secsTo() or msecsTo() functions. 
> 
> QTime can be used to measure a span of elapsed time using the start(), restart(), and elapsed() functions. 
> 
-- 
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



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