CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/DataFormats/Provenance/interface/Timestamp.h

Go to the documentation of this file.
00001 #ifndef DataFormats_Provenance_Timestamp_h
00002 #define DataFormats_Provenance_Timestamp_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     DataFormats/Provenance
00006 // Class:      Timestamp
00007 //
00016 //
00017 // Author:      Chris Jones
00018 // Created:     Thu Mar 24 16:23:05 EST 2005
00019 //
00020 
00021 // system include files
00022 
00023 // user include files
00024 
00025 // forward declarations
00026 namespace edm {
00027    typedef unsigned long long TimeValue_t;
00028 
00029 class Timestamp {
00030 
00031    public:
00032       explicit Timestamp(TimeValue_t iValue);
00033       Timestamp();
00034 
00036       unsigned int
00037       unixTime() const {
00038         return timeHigh_;
00039       }
00040 
00042       unsigned int
00043       microsecondOffset() const {
00044         return timeLow_;
00045       }
00046 
00047       TimeValue_t value() const;
00048 
00049       // ---------- const member functions ---------------------
00050       bool operator==(Timestamp const& iRHS) const {
00051          return timeHigh_ == iRHS.timeHigh_ &&
00052          timeLow_ == iRHS.timeLow_;
00053       }
00054       bool operator!=(Timestamp const& iRHS) const {
00055          return !(*this == iRHS);
00056       }
00057 
00058       bool operator<(Timestamp const& iRHS) const {
00059          if(timeHigh_ == iRHS.timeHigh_) {
00060             return timeLow_ < iRHS.timeLow_;
00061          }
00062          return timeHigh_ < iRHS.timeHigh_;
00063       }
00064       bool operator<=(Timestamp const& iRHS) const {
00065          if(timeHigh_ == iRHS.timeHigh_) {
00066             return timeLow_ <= iRHS.timeLow_;
00067          }
00068          return timeHigh_ <= iRHS.timeHigh_;
00069       }
00070       bool operator>(Timestamp const& iRHS) const {
00071          if(timeHigh_ == iRHS.timeHigh_) {
00072             return timeLow_ > iRHS.timeLow_;
00073          }
00074          return timeHigh_ > iRHS.timeHigh_;
00075       }
00076       bool operator>=(Timestamp const& iRHS) const {
00077          if(timeHigh_ == iRHS.timeHigh_) {
00078             return timeLow_ >= iRHS.timeLow_;
00079          }
00080          return timeHigh_ >= iRHS.timeHigh_;
00081       }
00082 
00083       // ---------- static member functions --------------------
00084       static Timestamp const& invalidTimestamp();
00085       static Timestamp const& endOfTime();
00086       static Timestamp const& beginOfTime();
00087 
00088       // ---------- member functions ---------------------------
00089 
00090    private:
00091       //Timestamp(Timestamp const&); // allow default
00092 
00093       //Timestamp const& operator=(Timestamp const&); // allow default
00094 
00095       // ---------- member data --------------------------------
00096       // ROOT does not support ULL
00097       //TimeValue_t time_;
00098       unsigned int timeLow_;
00099       unsigned int timeHigh_;
00100 };
00101 
00102 }
00103 #endif