OpenDaVINCI  4.16.0
TimeStamp.h
Go to the documentation of this file.
1 
20 #ifndef OPENDAVINCI_CORE_DATA_TIMESTAMP_H_
21 #define OPENDAVINCI_CORE_DATA_TIMESTAMP_H_
22 
23 #include <string>
24 
25 #include "opendavinci/generated/odcore/data/TimePoint.h"
29 
30 namespace odcore {
31  namespace data {
32 
33  using namespace std;
34 
39  private:
40  friend class Container;
41 
42  private:
43  enum CUMULATIVE_DAYS {
44  January = 31, // 31
45  February = 59, // 28
46  March = 90, // 31
47  April = 120, // 30
48  May = 151, // 31
49  June = 181, // 30
50  July = 212, // 31
51  August = 243, // 31
52  September = 273,// 30
53  October = 304, // 31
54  November = 334, // 30
55  December = 365 // 31
56  };
57 
58  public:
59  TimeStamp();
60 
67  TimeStamp(const int32_t &seconds, const int32_t &microseconds);
68 
69  virtual ~TimeStamp();
70 
76  TimeStamp(const string &ddmmyyyyhhmmss);
77 
83  TimeStamp(const TimeStamp &obj);
84 
90  TimeStamp(const TimePoint &obj);
91 
98  TimeStamp& operator=(const TimeStamp &obj);
99 
106  TimeStamp operator+(const TimeStamp& t) const;
107 
114  TimeStamp operator-(const TimeStamp& t) const;
115 
116  bool operator==(const TimeStamp& t) const;
117  bool operator!=(const TimeStamp& t) const;
118  bool operator<(const TimeStamp& t) const;
119  bool operator>(const TimeStamp& t) const;
120  bool operator<=(const TimeStamp& t) const;
121  bool operator>=(const TimeStamp& t) const;
122 
129  int64_t toMicroseconds() const;
130 
137  int32_t getFractionalMicroseconds() const;
138 
145  uint32_t getHour() const;
146 
153  uint32_t getMinute() const;
154 
161  uint32_t getSecond() const;
162 
169  uint32_t getDay() const;
170 
177  uint32_t getMonth() const;
178 
185  uint32_t getYear() const;
186 
193  const string getYYYYMMDD_HHMMSS() const;
194 
201  const string getYYYYMMDD_HHMMSS_noBlank() const;
202 
209  const string getYYYYMMDD_HHMMSS_noBlankNoColons() const;
210 
217  const string getYYYYMMDD_HHMMSSms() const;
218 
219  private:
227  bool isLeapYear(const uint32_t &year) const;
228 
232  void computeHumanReadableRepresentation();
233 
234  private:
235  uint32_t m_readableYear;
236  uint32_t m_readableMonth;
237  uint32_t m_readableDayOfMonth;
238  uint32_t m_readableHours;
239  uint32_t m_readableMinutes;
240  uint32_t m_readableSeconds;
241  };
242 
243  }
244 } // odcore::data
245 
246 #endif /*OPENDAVINCI_CORE_DATA_TIMESTAMP_H_*/
Definition: Container.h:40
#define OPENDAVINCI_API
Definition: opendavinci.h:67
Definition: TimeStamp.h:38