Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
27class TTime {
28
29private:
30 Long64_t fMilliSec; // time with millisecond precision
31
32public:
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
66inline TTime& TTime::operator= (const TTime &t)
67 { fMilliSec = t.fMilliSec; return *this; }
69 { fMilliSec += t.fMilliSec; return *this; }
71 { fMilliSec -= t.fMilliSec; return *this; }
73 { fMilliSec *= t.fMilliSec; return *this; }
75 { fMilliSec /= t.fMilliSec; return *this; }
76inline TTime::operator long long() const
77 { return fMilliSec; }
78inline TTime::operator unsigned long long() const
79 { return (ULong64_t) fMilliSec; }
80
81inline TTime operator+(const TTime &t1, const TTime &t2)
82 { return TTime(t1.fMilliSec + t2.fMilliSec); }
83inline TTime operator-(const TTime &t1, const TTime &t2)
84 { return TTime(t1.fMilliSec - t2.fMilliSec); }
85inline TTime operator*(const TTime &t1, const TTime &t2)
86 { return TTime(t1.fMilliSec * t2.fMilliSec); }
87inline TTime operator/(const TTime &t1, const TTime &t2)
88 { return TTime(t1.fMilliSec / t2.fMilliSec); }
89
90inline Bool_t operator== (const TTime &t1, const TTime &t2)
91 { return t1.fMilliSec == t2.fMilliSec; }
92inline Bool_t operator!= (const TTime &t1, const TTime &t2)
93 { return t1.fMilliSec != t2.fMilliSec; }
94inline Bool_t operator< (const TTime &t1, const TTime &t2)
95 { return t1.fMilliSec < t2.fMilliSec; }
96inline Bool_t operator<= (const TTime &t1, const TTime &t2)
97 { return t1.fMilliSec <= t2.fMilliSec; }
98inline Bool_t operator> (const TTime &t1, const TTime &t2)
99 { return t1.fMilliSec > t2.fMilliSec; }
100inline Bool_t operator>= (const TTime &t1, const TTime &t2)
101 { return t1.fMilliSec >= t2.fMilliSec; }
102
103#endif
long
bool Bool_t
Definition RtypesCore.h:63
long long Long64_t
Definition RtypesCore.h:80
unsigned long long ULong64_t
Definition RtypesCore.h:81
#define ClassDef(name, id)
Definition Rtypes.h:325
Bool_t operator>=(const TTime &t1, const TTime &t2)
Definition TTime.h:100
Bool_t operator==(const TTime &t1, const TTime &t2)
Definition TTime.h:90
Bool_t operator<=(const TTime &t1, const TTime &t2)
Definition TTime.h:96
TTime operator*(const TTime &t1, const TTime &t2)
Definition TTime.h:85
TTime operator+(const TTime &t1, const TTime &t2)
Definition TTime.h:81
TTime operator/(const TTime &t1, const TTime &t2)
Definition TTime.h:87
TTime operator-(const TTime &t1, const TTime &t2)
Definition TTime.h:83
Bool_t operator<(const TTime &t1, const TTime &t2)
Definition TTime.h:94
Bool_t operator>(const TTime &t1, const TTime &t2)
Definition TTime.h:98
Bool_t operator!=(const TTime &t1, const TTime &t2)
Definition TTime.h:92
Basic time type with millisecond precision.
Definition TTime.h:27
friend Bool_t operator>=(const TTime &t1, const TTime &t2)
Definition TTime.h:100
TTime operator*=(const TTime &t)
Definition TTime.h:72
friend Bool_t operator==(const TTime &t1, const TTime &t2)
Definition TTime.h:90
TTime(Long64_t msec)
Definition TTime.h:34
friend Bool_t operator<=(const TTime &t1, const TTime &t2)
Definition TTime.h:96
TTime operator/=(const TTime &t)
Definition TTime.h:74
friend TTime operator*(const TTime &t1, const TTime &t2)
Definition TTime.h:85
friend TTime operator+(const TTime &t1, const TTime &t2)
Definition TTime.h:81
TTime(const TTime &t)
Definition TTime.h:35
const char * AsString() const
Return the time as a string.
Definition TTime.cxx:28
friend TTime operator/(const TTime &t1, const TTime &t2)
Definition TTime.h:87
TTime & operator=(const TTime &t)
Definition TTime.h:66
TTime operator-=(const TTime &t)
Definition TTime.h:70
TTime()
Definition TTime.h:33
TTime operator+=(const TTime &t)
Definition TTime.h:68
friend TTime operator-(const TTime &t1, const TTime &t2)
Definition TTime.h:83
friend Bool_t operator<(const TTime &t1, const TTime &t2)
Definition TTime.h:94
friend Bool_t operator>(const TTime &t1, const TTime &t2)
Definition TTime.h:98
virtual ~TTime()
Definition TTime.h:36
Long64_t fMilliSec
Definition TTime.h:30
friend Bool_t operator!=(const TTime &t1, const TTime &t2)
Definition TTime.h:92
auto * t1
Definition textangle.C:20