CMS 3D CMS Logo

TimeSpec.h
Go to the documentation of this file.
1 
2 #ifndef DataFormats_Scalers_TimeSpec_h
3 #define DataFormats_Scalers_TimeSpec_h
4 
5 #include <ctime>
6 
7 class TimeSpec {
8 
9 public:
10 
12  tv_sec_(0),
13  tv_nsec_(0) {}
14 
15  TimeSpec(long tv_sec, long tv_nsec) :
16  tv_sec_(tv_sec),
17  tv_nsec_(tv_nsec) {}
18 
19  TimeSpec(timespec const& ts) :
20  tv_sec_(static_cast<long>(ts.tv_sec)),
21  tv_nsec_(static_cast<long>(ts.tv_nsec)) {}
22 
23  long tv_sec() const { return tv_sec_; }
24  long tv_nsec() const { return tv_nsec_; }
25 
26  void set_tv_sec(long value) { tv_sec_ = value; }
27  void set_tv_nsec(long value) { tv_nsec_ = value; }
28 
29  timespec get_timespec() const;
30 
31 private:
32 
33  long tv_sec_; // seconds
34  long tv_nsec_; // nanoseconds
35 };
36 
37 #endif
long tv_sec() const
Definition: TimeSpec.h:23
void set_tv_nsec(long value)
Definition: TimeSpec.h:27
long tv_nsec() const
Definition: TimeSpec.h:24
timespec get_timespec() const
Definition: TimeSpec.cc:4
long tv_sec_
Definition: TimeSpec.h:33
TimeSpec(long tv_sec, long tv_nsec)
Definition: TimeSpec.h:15
long tv_nsec_
Definition: TimeSpec.h:34
TimeSpec()
Definition: TimeSpec.h:11
Definition: value.py:1
TimeSpec(timespec const &ts)
Definition: TimeSpec.h:19
void set_tv_sec(long value)
Definition: TimeSpec.h:26