Scheduler: Avoid unnecessary now() calls in ClockService
g0dil [Wed, 25 Aug 2010 11:35:43 +0000 (11:35 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1698 270642c3-0616-0410-b53a-bc976706d245

senf/Scheduler/ClockService.cci

index 38f353b..9b70a3a 100644 (file)
@@ -45,9 +45,11 @@ prefix_ senf::ClockService::clock_type senf::ClockService::now()
 ////////////////////////////////////////
 // private members
 
+namespace senf { namespace scheduler { ClockService::clock_type now(); } }
+
 prefix_ senf::ClockService::clock_type senf::ClockService::clock_m(abstime_type time)
 {
-    if (now() - baseClock_ > 1000000000ll)
+    if (senf::scheduler::now() - baseClock_ > 1000000000ll)
         restart_m();
     boost::posix_time::time_duration delta (time - baseAbstime_);
     return baseClock_ + clock_type( delta.ticks() )
@@ -58,7 +60,7 @@ prefix_ senf::ClockService::abstime_type senf::ClockService::abstime_m(clock_typ
 {
     if (clock == 0)
         return abstime_type();
-    if (now() - baseClock_ > 1000000000ll)
+    if (senf::scheduler::now() - baseClock_ > 1000000000ll)
         restart_m();
 #ifdef BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
     return baseAbstime_ + boost::posix_time::nanoseconds(clock-baseClock_);