CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Timestamp.h
Go to the documentation of this file.
1 #ifndef DataFormats_Provenance_Timestamp_h
2 #define DataFormats_Provenance_Timestamp_h
3 // -*- C++ -*-
4 //
5 // Package: DataFormats/Provenance
6 // Class: Timestamp
7 //
16 //
17 // Author: Chris Jones
18 // Created: Thu Mar 24 16:23:05 EST 2005
19 //
20 
21 // system include files
22 
23 // user include files
24 
25 // forward declarations
26 namespace edm {
27  typedef unsigned long long TimeValue_t;
28 
29 class Timestamp {
30 
31  public:
32  explicit Timestamp(TimeValue_t iValue);
33  Timestamp();
34 
36  unsigned int
37  unixTime() const {
38  return timeHigh_;
39  }
40 
42  unsigned int
44  return timeLow_;
45  }
46 
47  TimeValue_t value() const;
48 
49  // ---------- const member functions ---------------------
50  bool operator==(Timestamp const& iRHS) const {
51  return timeHigh_ == iRHS.timeHigh_ &&
52  timeLow_ == iRHS.timeLow_;
53  }
54  bool operator!=(Timestamp const& iRHS) const {
55  return !(*this == iRHS);
56  }
57 
58  bool operator<(Timestamp const& iRHS) const {
59  if(timeHigh_ == iRHS.timeHigh_) {
60  return timeLow_ < iRHS.timeLow_;
61  }
62  return timeHigh_ < iRHS.timeHigh_;
63  }
64  bool operator<=(Timestamp const& iRHS) const {
65  if(timeHigh_ == iRHS.timeHigh_) {
66  return timeLow_ <= iRHS.timeLow_;
67  }
68  return timeHigh_ <= iRHS.timeHigh_;
69  }
70  bool operator>(Timestamp const& iRHS) const {
71  if(timeHigh_ == iRHS.timeHigh_) {
72  return timeLow_ > iRHS.timeLow_;
73  }
74  return timeHigh_ > iRHS.timeHigh_;
75  }
76  bool operator>=(Timestamp const& iRHS) const {
77  if(timeHigh_ == iRHS.timeHigh_) {
78  return timeLow_ >= iRHS.timeLow_;
79  }
80  return timeHigh_ >= iRHS.timeHigh_;
81  }
82 
83  // ---------- static member functions --------------------
84  static Timestamp const& invalidTimestamp();
85  static Timestamp const& endOfTime();
86  static Timestamp const& beginOfTime();
87 
88  // ---------- member functions ---------------------------
89 
90  private:
91  //Timestamp(Timestamp const&); // allow default
92 
93  //Timestamp const& operator=(Timestamp const&); // allow default
94 
95  // ---------- member data --------------------------------
96  // ROOT does not support ULL
97  //TimeValue_t time_;
98  unsigned int timeLow_;
99  unsigned int timeHigh_;
100 };
101 
102 }
103 #endif
bool operator!=(Timestamp const &iRHS) const
Definition: Timestamp.h:54
unsigned int microsecondOffset() const
Microseconds offset within second.
Definition: Timestamp.h:43
bool operator<=(Timestamp const &iRHS) const
Definition: Timestamp.h:64
unsigned int timeHigh_
Definition: Timestamp.h:99
bool operator>=(Timestamp const &iRHS) const
Definition: Timestamp.h:76
bool operator>(Timestamp const &iRHS) const
Definition: Timestamp.h:70
bool operator<(Timestamp const &iRHS) const
Definition: Timestamp.h:58
unsigned int unixTime() const
Time in seconds since January 1, 1970.
Definition: Timestamp.h:37
unsigned long long TimeValue_t
Definition: Timestamp.h:27
TimeValue_t value() const
Definition: Timestamp.cc:72
unsigned int timeLow_
Definition: Timestamp.h:98
static Timestamp const & invalidTimestamp()
Definition: Timestamp.cc:83
bool operator==(Timestamp const &iRHS) const
Definition: Timestamp.h:50
static Timestamp const & beginOfTime()
Definition: Timestamp.cc:96
static Timestamp const & endOfTime()
Definition: Timestamp.cc:88