CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/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 
00035       virtual ~Timestamp();
00036 
00038       unsigned int
00039       unixTime() const {
00040         return timeHigh_;
00041       }
00042 
00044       unsigned int
00045       nanosecondOffset() const {
00046         return timeLow_;
00047       }
00048 
00049       TimeValue_t value() const;
00050 
00051       // ---------- const member functions ---------------------
00052       bool operator==(Timestamp const& iRHS) const {
00053          return timeHigh_ == iRHS.timeHigh_ &&
00054          timeLow_ == iRHS.timeLow_;
00055       }
00056       bool operator!=(Timestamp const& iRHS) const {
00057          return !(*this == iRHS);
00058       }
00059 
00060       bool operator<(Timestamp const& iRHS) const {
00061          if(timeHigh_ == iRHS.timeHigh_) {
00062             return timeLow_ < iRHS.timeLow_;
00063          }
00064          return timeHigh_ < iRHS.timeHigh_;
00065       }
00066       bool operator<=(Timestamp const& iRHS) const {
00067          if(timeHigh_ == iRHS.timeHigh_) {
00068             return timeLow_ <= iRHS.timeLow_;
00069          }
00070          return timeHigh_ <= iRHS.timeHigh_;
00071       }
00072       bool operator>(Timestamp const& iRHS) const {
00073          if(timeHigh_ == iRHS.timeHigh_) {
00074             return timeLow_ > iRHS.timeLow_;
00075          }
00076          return timeHigh_ > iRHS.timeHigh_;
00077       }
00078       bool operator>=(Timestamp const& iRHS) const {
00079          if(timeHigh_ == iRHS.timeHigh_) {
00080             return timeLow_ >= iRHS.timeLow_;
00081          }
00082          return timeHigh_ >= iRHS.timeHigh_;
00083       }
00084 
00085       // ---------- static member functions --------------------
00086       static Timestamp const& invalidTimestamp();
00087       static Timestamp const& endOfTime();
00088       static Timestamp const& beginOfTime();
00089 
00090       // ---------- member functions ---------------------------
00091 
00092    private:
00093       //Timestamp(Timestamp const&); // allow default
00094 
00095       //Timestamp const& operator=(Timestamp const&); // allow default
00096 
00097       // ---------- member data --------------------------------
00098       // ROOT does not support ULL
00099       //TimeValue_t time_;
00100       unsigned int timeLow_;
00101       unsigned int timeHigh_;
00102 };
00103 
00104 }
00105 #endif