X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Scheduler%2FClockService.hh;h=e0e39395341851f5f71c5aa2c47661dd6f4ee15e;hb=f2cc6f8a4ca99301f9f26156803e541ec2dff66b;hp=04bcc1a55337298ec6f277d176b485fd6c8d9ef0;hpb=d5ba3d7759212c90a5f4a25baf0dc38e290c3b64;p=senf.git diff --git a/Scheduler/ClockService.hh b/Scheduler/ClockService.hh index 04bcc1a..e0e3939 100644 --- a/Scheduler/ClockService.hh +++ b/Scheduler/ClockService.hh @@ -84,6 +84,13 @@ namespace senf { in the normal case (no clock skew) and still encapsulate the dependency on legacy C headers. Using the senf::singleton mixin ensures, that the instance is constructed before main even when instance() is not called. + + \bug There is a deadlock condition between ClockService and the streaming of Boost.DateTime + values: Boost.DateTime seems to call tzset() whenever writing a date/time value (ugh) + and since tzset changes basic date/time values, it seems to block gettimeofday() which + leads to the SIGLARM handler blocking indefinitely. Resolution either a) find out, why + tzset() of all functions is called or b) move the ClockService heartbeat functionality + into the Scheduler. */ class ClockService : singleton @@ -98,6 +105,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 @@ -141,13 +149,21 @@ namespace senf { /**< This member converts an absolute time value represented as a timeval value into a clock value */ - 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 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();