X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Scheduler%2FClockService.cc;h=e481c142652acbce3c3552151ed41c42e9c33bbe;hb=9bfe0b87be0926193b5baf13865cf045f0de0b0d;hp=a614462add9fe6ac82671b071700b427abf6c2ff;hpb=e8b91aa6a817af6d9a3714e7b66be6c0d6b0a4e5;p=senf.git diff --git a/Scheduler/ClockService.cc b/Scheduler/ClockService.cc index a614462..e481c14 100644 --- a/Scheduler/ClockService.cc +++ b/Scheduler/ClockService.cc @@ -31,7 +31,7 @@ #include #include #include -#include "Utils/Exception.hh" +#include "../Utils/Exception.hh" //#include "ClockService.mpp" #define prefix_ @@ -125,14 +125,19 @@ prefix_ void senf::ClockService::restart_m(bool restart) action.sa_flags = SA_RESTART; CheckError( sigaction, (SIGALRM, &action, restart ? 0 : &impl_->oldaction) ); + restartTimer(restart); + + impl_->unblock(); +} + +prefix_ void senf::ClockService::restartTimer(bool restart) +{ struct itimerval itimer; itimer.it_interval.tv_sec = CheckInterval; itimer.it_interval.tv_usec = 0; itimer.it_value.tv_sec = CheckInterval; itimer.it_value.tv_usec = 0; CheckError( setitimer, (ITIMER_REAL, &itimer, restart ? 0 : &impl_->olditimer) ); - - impl_->unblock(); } prefix_ void senf::ClockService::updateSkew(boost::posix_time::ptime time) @@ -149,6 +154,8 @@ prefix_ void senf::ClockService::updateSkew(boost::posix_time::ptime time) + boost::posix_time::seconds(CheckInterval) - boost::posix_time::seconds(itimer.it_value.tv_sec) - boost::posix_time::microseconds(itimer.it_value.tv_usec))); + heartbeat_ = time; + restartTimer(); } }