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 
35  virtual ~Timestamp();
36 
38  unsigned int
39  unixTime() const {
40  return timeHigh_;
41  }
42 
44  unsigned int
46  return timeLow_;
47  }
48 
49  TimeValue_t value() const;
50 
51  // ---------- const member functions ---------------------
52  bool operator==(Timestamp const& iRHS) const {
53  return timeHigh_ == iRHS.timeHigh_ &&
54  timeLow_ == iRHS.timeLow_;
55  }
56  bool operator!=(Timestamp const& iRHS) const {
57  return !(*this == iRHS);
58  }
59 
60  bool operator<(Timestamp const& iRHS) const {
61  if(timeHigh_ == iRHS.timeHigh_) {
62  return timeLow_ < iRHS.timeLow_;
63  }
64  return timeHigh_ < iRHS.timeHigh_;
65  }
66  bool operator<=(Timestamp const& iRHS) const {
67  if(timeHigh_ == iRHS.timeHigh_) {
68  return timeLow_ <= iRHS.timeLow_;
69  }
70  return timeHigh_ <= iRHS.timeHigh_;
71  }
72  bool operator>(Timestamp const& iRHS) const {
73  if(timeHigh_ == iRHS.timeHigh_) {
74  return timeLow_ > iRHS.timeLow_;
75  }
76  return timeHigh_ > iRHS.timeHigh_;
77  }
78  bool operator>=(Timestamp const& iRHS) const {
79  if(timeHigh_ == iRHS.timeHigh_) {
80  return timeLow_ >= iRHS.timeLow_;
81  }
82  return timeHigh_ >= iRHS.timeHigh_;
83  }
84 
85  // ---------- static member functions --------------------
86  static Timestamp const& invalidTimestamp();
87  static Timestamp const& endOfTime();
88  static Timestamp const& beginOfTime();
89 
90  // ---------- member functions ---------------------------
91 
92  private:
93  //Timestamp(Timestamp const&); // allow default
94 
95  //Timestamp const& operator=(Timestamp const&); // allow default
96 
97  // ---------- member data --------------------------------
98  // ROOT does not support ULL
99  //TimeValue_t time_;
100  unsigned int timeLow_;
101  unsigned int timeHigh_;
102 };
103 
104 }
105 #endif
bool operator!=(Timestamp const &iRHS) const
Definition: Timestamp.h:56
unsigned int microsecondOffset() const
Microseconds offset within second.
Definition: Timestamp.h:45
bool operator<=(Timestamp const &iRHS) const
Definition: Timestamp.h:66
unsigned int timeHigh_
Definition: Timestamp.h:101
bool operator>=(Timestamp const &iRHS) const
Definition: Timestamp.h:78
virtual ~Timestamp()
Definition: Timestamp.cc:48
bool operator>(Timestamp const &iRHS) const
Definition: Timestamp.h:72
bool operator<(Timestamp const &iRHS) const
Definition: Timestamp.h:60
unsigned int unixTime() const
Time in seconds since January 1, 1970.
Definition: Timestamp.h:39
unsigned long long TimeValue_t
Definition: Timestamp.h:27
TimeValue_t value() const
Definition: Timestamp.cc:72
unsigned int timeLow_
Definition: Timestamp.h:100
static Timestamp const & invalidTimestamp()
Definition: Timestamp.cc:83
bool operator==(Timestamp const &iRHS) const
Definition: Timestamp.h:52
static Timestamp const & beginOfTime()
Definition: Timestamp.cc:96
static Timestamp const & endOfTime()
Definition: Timestamp.cc:88