X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Scheduler%2FClockService.hh;h=255fcbee9fae4edbbaa6770d632a12a9e2f2e014;hb=22e56fa8ef4cea3fd55c9463ecd2af8a6fbd213d;hp=ba9b2ac5fc442232f99787f1fff8d0a3b8acd3e4;hpb=a1a6c76a214ad1935032826713cabaf9ac57bf07;p=senf.git diff --git a/Scheduler/ClockService.hh b/Scheduler/ClockService.hh index ba9b2ac..255fcbe 100644 --- a/Scheduler/ClockService.hh +++ b/Scheduler/ClockService.hh @@ -27,6 +27,7 @@ #define HH_ClockService_ 1 // Custom includes +#include #include #include #include @@ -97,6 +98,7 @@ namespace senf { nanoseconds relative to some implementation defined reference time. */ typedef boost::int_fast64_t clock_type; + typedef boost::int_fast64_t int64_type; /** \brief Absolute time data type @@ -130,13 +132,31 @@ namespace senf { corresponding clock value. \see abstime */ - static clock_type nanoseconds(clock_type v); - static clock_type microseconds(clock_type v); - static clock_type milliseconds(clock_type v); - static clock_type seconds(clock_type v); - static clock_type minutes(clock_type v); - static clock_type hours(clock_type v); - static clock_type days(clock_type v); + static clock_type from_time_t(time_t const & time); + ///< Convert legacy time_t to clock value + /**< This member converts an absolute time value + represented as a time_t value into a clock value */ + + static clock_type from_timeval(timeval const & time); + ///< Convert legacy timeval to clock value + /**< This member converts an absolute time value + represented as a timeval value into a clock value */ + + static clock_type nanoseconds(int64_type v); ///< Convert \a v nanoseconds to clock_type + static clock_type microseconds(int64_type v); ///< Convert \a v microseconds to clock_type + static clock_type milliseconds(int64_type v); ///< Convert \a v milliseconds to clock_type + static clock_type seconds(int64_type v); ///< Convert \a v seconds to clock_type + static clock_type minutes(int64_type v); ///< Convert \a v minutes to clock_type + static clock_type hours(int64_type v); ///< Convert \a v hours to clock_type + static clock_type days(int64_type v); ///< Convert \a v days to clock_type + + static int64_type in_nanoseconds(clock_type v); ///< Convert \a v to nanoseconds + static int64_type in_microseconds(clock_type v); ///< Convert \a v to microseconds + static int64_type in_milliseconds(clock_type v); ///< Convert \a v to milliseconds + static int64_type in_seconds(clock_type v); ///< Convert \a v to seconds + static int64_type in_minutes(clock_type v); ///< Convert \a v to minutes + static int64_type in_hours(clock_type v); ///< Convert \a v to hours + static int64_type in_days(clock_type v); ///< Convert \a v to days static void restart();