1 #ifndef _TIMESTAMP_H___
2 #define _TIMESTAMP_H___
5 #include <linux/can/bcm.h>
7 #ifndef HAVE_BCM_TIMEVAL
9 #define bcm_timeval timeval
18 * \brief The Timestamp class provides system time and monotonic time helper functions
19 * Timestamp is meant to be a singleton class. Access through instance().
21 * double currentMonotonicTime = amb::Timestamp::instance()->currentTime();
22 * double epocTimeForMonotonicTime = amb::Timestamp::instance()->epochTime(currentMonotonicTime);
33 * \return current monotonic (steady) time in seconds.
36 double currentTime(double time);
40 * \param time monotonic time usually from currentTime()
41 * \return number of seconds.milliseconds since unix epoch
43 double epochTime(double time);
47 * \return current system time in seconds since unix epoch
51 static double fromTimeval(const struct ::timeval& tv);
52 static struct ::timeval toTimeval(const double time);
54 static struct ::bcm_timeval toBcmTimeval(const double time);
59 * \return instance of Timestamp;
61 static Timestamp *instance();
64 double startTimeEpoch;
65 static Timestamp* mInstance;