Logo ROOT  
Reference Guide
TTime.h
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Fons Rademakers 28/11/96
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TTime
13 #define ROOT_TTime
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TTime //
19 // //
20 // Basic time type with millisecond precision. //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #include "Rtypes.h"
25 
26 
27 class TTime {
28 
29 private:
30  Long64_t fMilliSec; // time with millisecond precision
31 
32 public:
33  TTime(): fMilliSec(0) { }
34  TTime(Long64_t msec): fMilliSec(msec) { }
35  TTime(const TTime &t): fMilliSec(t.fMilliSec) { }
36  virtual ~TTime() { }
37 
38  TTime& operator=(const TTime &t);
39 
40  TTime operator+=(const TTime &t);
41  TTime operator-=(const TTime &t);
42  TTime operator*=(const TTime &t);
43  TTime operator/=(const TTime &t);
44 
45  friend TTime operator+(const TTime &t1, const TTime &t2);
46  friend TTime operator-(const TTime &t1, const TTime &t2);
47  friend TTime operator*(const TTime &t1, const TTime &t2);
48  friend TTime operator/(const TTime &t1, const TTime &t2);
49 
50  friend Bool_t operator== (const TTime &t1, const TTime &t2);
51  friend Bool_t operator!= (const TTime &t1, const TTime &t2);
52  friend Bool_t operator< (const TTime &t1, const TTime &t2);
53  friend Bool_t operator<= (const TTime &t1, const TTime &t2);
54  friend Bool_t operator> (const TTime &t1, const TTime &t2);
55  friend Bool_t operator>= (const TTime &t1, const TTime &t2);
56 
57  operator long() const;
58  operator unsigned long() const;
59  operator long long() const;
60  operator unsigned long long() const;
61  const char *AsString() const;
62 
63  ClassDef(TTime,2) //Basic time type with milli second precision
64 };
65 
66 inline TTime& TTime::operator= (const TTime &t)
67  { fMilliSec = t.fMilliSec; return *this; }
68 inline TTime TTime::operator+=(const TTime &t)
69  { fMilliSec += t.fMilliSec; return *this; }
70 inline TTime TTime::operator-=(const TTime &t)
71  { fMilliSec -= t.fMilliSec; return *this; }
72 inline TTime TTime::operator*=(const TTime &t)
73  { fMilliSec *= t.fMilliSec; return *this; }
74 inline TTime TTime::operator/=(const TTime &t)
75  { fMilliSec /= t.fMilliSec; return *this; }
76 inline TTime::operator long long() const
77  { return fMilliSec; }
78 inline TTime::operator unsigned long long() const
79  { return (ULong64_t) fMilliSec; }
80 
81 inline TTime operator+(const TTime &t1, const TTime &t2)
82  { return TTime(t1.fMilliSec + t2.fMilliSec); }
83 inline TTime operator-(const TTime &t1, const TTime &t2)
84  { return TTime(t1.fMilliSec - t2.fMilliSec); }
85 inline TTime operator*(const TTime &t1, const TTime &t2)
86  { return TTime(t1.fMilliSec * t2.fMilliSec); }
87 inline TTime operator/(const TTime &t1, const TTime &t2)
88  { return TTime(t1.fMilliSec / t2.fMilliSec); }
89 
90 inline Bool_t operator== (const TTime &t1, const TTime &t2)
91  { return t1.fMilliSec == t2.fMilliSec; }
92 inline Bool_t operator!= (const TTime &t1, const TTime &t2)
93  { return t1.fMilliSec != t2.fMilliSec; }
94 inline Bool_t operator< (const TTime &t1, const TTime &t2)
95  { return t1.fMilliSec < t2.fMilliSec; }
96 inline Bool_t operator<= (const TTime &t1, const TTime &t2)
97  { return t1.fMilliSec <= t2.fMilliSec; }
98 inline Bool_t operator> (const TTime &t1, const TTime &t2)
99  { return t1.fMilliSec > t2.fMilliSec; }
100 inline Bool_t operator>= (const TTime &t1, const TTime &t2)
101  { return t1.fMilliSec >= t2.fMilliSec; }
102 
103 #endif
TTime::~TTime
virtual ~TTime()
Definition: TTime.h:36
operator>
Bool_t operator>(const TTime &t1, const TTime &t2)
Definition: TTime.h:98
operator==
Bool_t operator==(const TTime &t1, const TTime &t2)
Definition: TTime.h:90
operator<=
Bool_t operator<=(const TTime &t1, const TTime &t2)
Definition: TTime.h:96
TTime::operator*
friend TTime operator*(const TTime &t1, const TTime &t2)
Definition: TTime.h:85
TTime::fMilliSec
Long64_t fMilliSec
Definition: TTime.h:30
TTime::operator==
friend Bool_t operator==(const TTime &t1, const TTime &t2)
Definition: TTime.h:90
Long64_t
long long Long64_t
Definition: RtypesCore.h:73
TTime::TTime
TTime()
Definition: TTime.h:33
operator>=
Bool_t operator>=(const TTime &t1, const TTime &t2)
Definition: TTime.h:100
operator-
TTime operator-(const TTime &t1, const TTime &t2)
Definition: TTime.h:83
long
long
Definition: Converters.cxx:858
TTime::operator<=
friend Bool_t operator<=(const TTime &t1, const TTime &t2)
Definition: TTime.h:96
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TTime::operator<
friend Bool_t operator<(const TTime &t1, const TTime &t2)
Definition: TTime.h:94
operator!=
Bool_t operator!=(const TTime &t1, const TTime &t2)
Definition: TTime.h:92
TTime::operator!=
friend Bool_t operator!=(const TTime &t1, const TTime &t2)
Definition: TTime.h:92
TTime::operator+
friend TTime operator+(const TTime &t1, const TTime &t2)
Definition: TTime.h:81
TTime::operator>=
friend Bool_t operator>=(const TTime &t1, const TTime &t2)
Definition: TTime.h:100
operator*
TTime operator*(const TTime &t1, const TTime &t2)
Definition: TTime.h:85
operator<
Bool_t operator<(const TTime &t1, const TTime &t2)
Definition: TTime.h:94
TTime
Basic time type with millisecond precision.
Definition: TTime.h:27
TTime::operator*=
TTime operator*=(const TTime &t)
Definition: TTime.h:72
TTime::TTime
TTime(const TTime &t)
Definition: TTime.h:35
TTime::operator>
friend Bool_t operator>(const TTime &t1, const TTime &t2)
Definition: TTime.h:98
operator/
TTime operator/(const TTime &t1, const TTime &t2)
Definition: TTime.h:87
TTime::operator=
TTime & operator=(const TTime &t)
Definition: TTime.h:66
ULong64_t
unsigned long long ULong64_t
Definition: RtypesCore.h:74
TTime::operator-=
TTime operator-=(const TTime &t)
Definition: TTime.h:70
t1
auto * t1
Definition: textangle.C:20
TTime::operator/=
TTime operator/=(const TTime &t)
Definition: TTime.h:74
TTime::operator-
friend TTime operator-(const TTime &t1, const TTime &t2)
Definition: TTime.h:83
operator+
TTime operator+(const TTime &t1, const TTime &t2)
Definition: TTime.h:81
TTime::AsString
const char * AsString() const
Return the time as a string.
Definition: TTime.cxx:28
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TTime::operator+=
TTime operator+=(const TTime &t)
Definition: TTime.h:68
Rtypes.h
TTime::operator/
friend TTime operator/(const TTime &t1, const TTime &t2)
Definition: TTime.h:87
TTime::TTime
TTime(Long64_t msec)
Definition: TTime.h:34