Class Reference for E1039 Core & Analysis Software
PHTimeStamp.h
Go to the documentation of this file.
1 // The PHOOL's Software
2 // Copyright (C) PHENIX collaboration, 1999
3 //
4 // Purpose: PHENIX - wide time stamp class
5 //
6 // Declaration of class PHTimeStamp
7 //
8 // Author: Matthias Messer
9 //-----------------------------------------------------------------------------
10 #ifndef PHTIMESTAMP_H__
11 #define PHTIMESTAMP_H__
12 
13 #include "PHObject.h"
14 
15 #include <ctime>
16 
17 
18 
19 typedef unsigned long long phtime_t;
20 
21  class PHTimeStamp : public PHObject
22 {
23 
24  public:
25  enum { PHFarFuture = 2147483647 };
26 
27  PHTimeStamp();
28 
29  PHTimeStamp(const int, const int, const int, const int, const int, const int, const int = 0);
30  PHTimeStamp(const time_t);
31  void setBinTics(const phtime_t t);
32 
33  virtual ~PHTimeStamp() {}
34 
35  public:
36  void set(const int, const int, const int, const int, const int, const int, const int = 0);
37 
38  void set(const char *);
39 
40  void setToSystemTime();
42 
43  phtime_t getBinaryTime() const { return binaryTime; }
44  time_t getTics() const;
45  void setTics(const time_t);
46 
47  int isInRange(const PHTimeStamp &, const PHTimeStamp &);
48  void print();
49 
50  int operator == (const PHTimeStamp &) const;
51  int operator != (const PHTimeStamp &) const;
52  int operator > (const PHTimeStamp &) const;
53  int operator >= (const PHTimeStamp &) const;
54  int operator < (const PHTimeStamp &) const;
55  int operator <= (const PHTimeStamp &) const;
56 
58  PHTimeStamp operator += (time_t);
59  PHTimeStamp operator -= (time_t);
60 
61 
62  char * formatTimeString() const;
63  void print() const;
64 
65  private:
66  phtime_t ticsToBinaryTime(time_t) const;
67  time_t binaryTimeToTics(phtime_t) const;
68 
69  protected:
71  ClassDef(PHTimeStamp,1)
72  };
73 
74  PHTimeStamp operator + (const PHTimeStamp &, time_t);
75  PHTimeStamp operator - (const PHTimeStamp &, time_t);
76  time_t operator - (const PHTimeStamp &, const PHTimeStamp &);
77 
78  std::ostream & operator << (std::ostream &, const PHTimeStamp &);
79  std::istream & operator >> (std::istream &, PHTimeStamp &);
80 
81 #endif /* __PHTIMESTAMP_H__ */
PHTimeStamp operator-(const PHTimeStamp &, time_t)
Definition: PHTimeStamp.cc:222
std::ostream & operator<<(std::ostream &, const PHTimeStamp &)
Definition: PHTimeStamp.cc:234
PHTimeStamp operator+(const PHTimeStamp &, time_t)
Definition: PHTimeStamp.cc:215
unsigned long long phtime_t
Definition: PHTimeStamp.h:19
std::istream & operator>>(std::istream &, PHTimeStamp &)
Definition: PHTimeStamp.cc:243
PHTimeStamp operator+=(time_t)
Definition: PHTimeStamp.cc:171
char * formatTimeString() const
Definition: PHTimeStamp.cc:187
PHTimeStamp & operator=(const PHTimeStamp &)
Definition: PHTimeStamp.cc:165
void setToSystemTime()
Definition: PHTimeStamp.cc:92
phtime_t getBinaryTime() const
Definition: PHTimeStamp.h:43
int operator<(const PHTimeStamp &) const
Definition: PHTimeStamp.cc:150
void print()
Definition: PHTimeStamp.cc:127
virtual ~PHTimeStamp()
Definition: PHTimeStamp.h:33
void set(const int, const int, const int, const int, const int, const int, const int=0)
Definition: PHTimeStamp.cc:58
PHTimeStamp operator-=(time_t)
Definition: PHTimeStamp.cc:177
phtime_t binaryTime
Definition: PHTimeStamp.h:70
int isInRange(const PHTimeStamp &, const PHTimeStamp &)
Definition: PHTimeStamp.cc:122
int operator>=(const PHTimeStamp &) const
Definition: PHTimeStamp.cc:155
void setTics(const time_t)
Definition: PHTimeStamp.cc:102
int operator==(const PHTimeStamp &) const
Definition: PHTimeStamp.cc:135
int operator<=(const PHTimeStamp &) const
Definition: PHTimeStamp.cc:160
void setToFarFuture()
Definition: PHTimeStamp.h:41
int operator!=(const PHTimeStamp &) const
Definition: PHTimeStamp.cc:140
time_t getTics() const
Definition: PHTimeStamp.cc:97
int operator>(const PHTimeStamp &) const
Definition: PHTimeStamp.cc:145
void setBinTics(const phtime_t t)
Definition: PHTimeStamp.cc:107