CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Timestamp.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EDProduct
4 // Module: Timestamp
5 //
6 // Description: <one line class summary>
7 //
8 // Implementation:
9 // <Notes on implementation>
10 //
11 // Author: Chris Jones
12 // Created: Thu Mar 24 16:27:03 EST 2005
13 //
14 
15 // system include files
16 
17 // user include files
19 
20 namespace edm {
21 //
22 // constants, enums and typedefs
23 //
24 
25 //
26 // static data member definitions
27 //
28 static const TimeValue_t kLowMask(0xFFFFFFFF);
29 
30 //
31 // constructors and destructor
32 //
34  timeLow_(static_cast<unsigned int>(kLowMask & iValue)),
35  timeHigh_(static_cast<unsigned int>(iValue >> 32))
36 {
37 }
38 
39 Timestamp::Timestamp() : timeLow_(invalidTimestamp().timeLow_),
40 timeHigh_(invalidTimestamp().timeHigh_)
41 {
42 }
43 // Timestamp::Timestamp(const Timestamp& rhs)
44 // {
45 // // do actual copying here;
46 // }
47 
49 {
50 }
51 
52 //
53 // assignment operators
54 //
55 // const Timestamp& Timestamp::operator=(const Timestamp& rhs)
56 // {
57 // //An exception safe implementation is
58 // Timestamp temp(rhs);
59 // swap(rhs);
60 //
61 // return *this;
62 // }
63 
64 //
65 // member functions
66 //
67 
68 //
69 // const member functions
70 //
73  TimeValue_t returnValue = timeHigh_;
74  returnValue = returnValue << 32;
75  returnValue += timeLow_;
76  return returnValue;
77 }
78 
79 //
80 // static member functions
81 //
82 const Timestamp&
84  static Timestamp s_invalid(0);
85  return s_invalid;
86 }
87 const Timestamp&
89  //calculate 2^N -1 where N is number of bits in TimeValue_t
90  // by doing 2^(N-1) - 1 + 2^(N-1)
91  const TimeValue_t temp = TimeValue_t(1) << (sizeof(TimeValue_t)/sizeof(char) * 8 - 1);
92  static Timestamp s_endOfTime((temp -1) + temp);
93  return s_endOfTime;
94 }
95 const Timestamp&
97  static Timestamp s_beginOfTime(1);
98  return s_beginOfTime;
99 }
100 
101 }
unsigned int timeHigh_
Definition: Timestamp.h:101
virtual ~Timestamp()
Definition: Timestamp.cc:48
static const TimeValue_t kLowMask(0xFFFFFFFF)
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
static Timestamp const & beginOfTime()
Definition: Timestamp.cc:96
static Timestamp const & endOfTime()
Definition: Timestamp.cc:88
unsigned long long TimeValue_t