Zero  0.1.0
eventlog.h
Go to the documentation of this file.
1 #ifndef __EVENTLOG_H
2 #define __EVENTLOG_H
3 
4 #include <boost/date_time/gregorian/gregorian.hpp>
5 #include <boost/date_time/posix_time/posix_time.hpp>
6 
8 public:
9 
10  /*
11  * Our timestamps are the number of miliseconds since
12  * Jan 1, 2015
13  */
14  // Defined in logrec.cpp
15  static boost::gregorian::date epoch;
16 
17  static const unsigned long MSEC_IN_DAY = 86400000;
18 
19  static unsigned long timestamp() {
20  boost::posix_time::ptime t =
21  boost::posix_time::microsec_clock::local_time();
22  long days = (t.date() - epoch).days();
23  long msec = t.time_of_day().total_milliseconds();
24 
25  return (unsigned long)days * MSEC_IN_DAY + msec;
26  };
27 
28  static std::string timestamp_to_str() {
29  // TODO implement
30  return "";
31  };
32 };
33 
34 #endif // __EVENTLOG_H
Definition: eventlog.h:7
static unsigned long timestamp()
Definition: eventlog.h:19
static std::string timestamp_to_str()
Definition: eventlog.h:28
static boost::gregorian::date epoch
Definition: eventlog.h:15
static const unsigned long MSEC_IN_DAY
Definition: eventlog.h:17