Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:38

0001 
0002 #ifndef DataFormats_Scalers_TimeSpec_h
0003 #define DataFormats_Scalers_TimeSpec_h
0004 
0005 #include <ctime>
0006 
0007 class TimeSpec {
0008 public:
0009   TimeSpec() : tv_sec_(0), tv_nsec_(0) {}
0010 
0011   TimeSpec(long tv_sec, long tv_nsec) : tv_sec_(tv_sec), tv_nsec_(tv_nsec) {}
0012 
0013   TimeSpec(timespec const& ts) : tv_sec_(static_cast<long>(ts.tv_sec)), tv_nsec_(static_cast<long>(ts.tv_nsec)) {}
0014 
0015   long tv_sec() const { return tv_sec_; }
0016   long tv_nsec() const { return tv_nsec_; }
0017 
0018   void set_tv_sec(long value) { tv_sec_ = value; }
0019   void set_tv_nsec(long value) { tv_nsec_ = value; }
0020 
0021   timespec get_timespec() const;
0022 
0023 private:
0024   long tv_sec_;   // seconds
0025   long tv_nsec_;  // nanoseconds
0026 };
0027 
0028 #endif