Added additional operators to RestrictedInt and made
pug [Wed, 7 Dec 2011 17:31:06 +0000 (17:31 +0000)]
senf::ClockService::clock_type a RestrictedInt on SENF_DEBUG

git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1835 270642c3-0616-0410-b53a-bc976706d245

20 files changed:
senf/PPI/ActiveFeeder.test.cc
senf/PPI/IntervalTimer.cc
senf/Scheduler/ClockService.cc
senf/Scheduler/ClockService.cci
senf/Scheduler/ClockService.hh
senf/Scheduler/ClockService.test.cc
senf/Scheduler/Scheduler.cc
senf/Scheduler/TimerEvent.cci
senf/Scheduler/TimerEvent.test.cc
senf/Scheduler/TimerEventProxy.ct
senf/Scheduler/TimerEventProxy.test.cc
senf/Scheduler/TimerSource.cc
senf/Socket/FileHandle.cci
senf/Socket/FileHandle.hh
senf/Socket/Protocols/DatagramSocketProtocol.cc
senf/Utils/Beeper.cc
senf/Utils/ClockTypeMacros.hh [new file with mode: 0644]
senf/Utils/Logger/LogFormat.cc
senf/Utils/Logger/TimeSource.cc
senf/Utils/RestrictedInt.hh

index 0081fcc..06c2d65 100644 (file)
@@ -71,7 +71,7 @@ SENF_AUTO_UNIT_TEST(activeFeeder)
     senf::ClockService::clock_type start (senf::ClockService::now());
     run( senf::ClockService::seconds(1));
     std::cerr << "\nActiveFeeder: "
-              << (sink.size()*1e9)/(senf::ClockService::now()-start)
+              << (sink.size()*1e9)/ (SENF_CLOCKTYPEVAL(senf::ClockService::now()) - SENF_CLOCKTYPEVAL(start))
               << " packets/s" << std::endl;
     BOOST_CHECK( sink.size() > 0);
 }
index 2af0aea..aacd6de 100644 (file)
@@ -33,6 +33,7 @@
 
 // Custom includes
 #include "EventManager.hh"
+#include <senf/Utils/ClockTypeMacros.hh>
 
 //#include "IntervalTimer.mpp"
 #define prefix_
@@ -60,7 +61,7 @@ prefix_ void senf::ppi::IntervalTimer::v_disable()
 
 prefix_ void senf::ppi::IntervalTimer::schedule()
 {
-    info_.expected = info_.intervalStart + ( interval_ * (info_.number+1) ) / eventsPerInterval_;
+    info_.expected = SENF_INT2CLOCKTYPE(SENF_CLOCKTYPEVAL(info_.intervalStart) + ( SENF_CLOCKTYPEVAL(interval_) * (info_.number+1) ) / eventsPerInterval_);
     timer_.timeout(info_.expected);
 }
 
index fcd8042..ec279e6 100644 (file)
@@ -34,7 +34,7 @@
 // Custom includes
 #include <boost/regex.hpp>
 #include <senf/Utils/Console/Traits.hh>
-
+#include <senf/Utils/ClockTypeMacros.hh>
 //#include "ClockService.mpp"
 #define prefix_
 //-/////////////////////////////////////////////////////////////////////////////////////////////////
@@ -43,7 +43,7 @@ prefix_ void
 senf::parseClockServiceInterval(console::ParseCommandInfo::TokensRange const & tokens,
                                 ClockService::clock_type & out)
 {
-    out = 0;
+    out = senf::ClockService::clock_type(0);
     std::string value;
     {
         console::CheckedArgumentIteratorWrapper arg (tokens);
index 6fd8bdd..bf27401 100644 (file)
@@ -32,6 +32,7 @@
 #include <time.h>
 #include <boost/date_time/posix_time/posix_time_types.hpp>
 #include <senf/Utils/Exception.hh>
+#include <senf/Utils/ClockTypeMacros.hh>
 
 #define prefix_ inline
 //-/////////////////////////////////////////////////////////////////////////////////////////////////
@@ -44,7 +45,7 @@ prefix_ senf::ClockService::clock_type senf::ClockService::now()
     struct timespec spec;
     if (clock_gettime(CLOCK_MONOTONIC, &spec) < 0)
         SENF_THROW_SYSTEM_EXCEPTION("clock_gettime()");
-    return spec.tv_sec * 1000000000LL + spec.tv_nsec;
+    return SENF_INT2CLOCKTYPE(spec.tv_sec * 1000000000LL + spec.tv_nsec);
 }
 
 //-/////////////////////////////////////////////////////////////////////////////////////////////////
@@ -54,7 +55,7 @@ namespace senf { namespace scheduler { ClockService::clock_type now(); } }
 
 prefix_ senf::ClockService::clock_type senf::ClockService::clock_m(abstime_type time)
 {
-    if (scheduler::now() - baseClock_ > 1000000000ll)
+    if (scheduler::now() - baseClock_ > clock_type(1000000000ll))
         restart_m();
     boost::posix_time::time_duration delta (time - baseAbstime_);
     return baseClock_ + clock_type( delta.ticks() )
@@ -65,12 +66,12 @@ prefix_ senf::ClockService::abstime_type senf::ClockService::abstime_m(clock_typ
 {
     if (clock == 0)
         return abstime_type();
-    if (scheduler::now() - baseClock_ > 1000000000ll)
+    if (scheduler::now() - baseClock_ > clock_type(1000000000ll))
         restart_m();
 #ifdef BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
     return baseAbstime_ + boost::posix_time::nanoseconds(clock-baseClock_);
 #else
-    return baseAbstime_ + boost::posix_time::microseconds((clock-baseClock_+500)/1000);
+    return baseAbstime_ + boost::posix_time::microseconds((clock.value() - baseClock_.value() + 500 )/1000);
 #endif
 }
 
@@ -97,7 +98,7 @@ prefix_ senf::ClockService::reltime_type senf::ClockService::reltime(clock_type
 #ifdef BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
     return boost::posix_time::nanoseconds(clock);
 #else
-    return  boost::posix_time::microseconds((clock+500)/1000);
+    return  boost::posix_time::microseconds((clock.value() + 500)/1000);
 #endif
 }
 
@@ -113,72 +114,72 @@ prefix_ senf::ClockService::clock_type senf::ClockService::from_time_t(time_t co
 
 prefix_ senf::ClockService::clock_type senf::ClockService::nanoseconds(int64_type v)
 {
-    return v;
+    return SENF_INT2CLOCKTYPE(v);
 }
 
 prefix_ senf::ClockService::clock_type senf::ClockService::microseconds(int64_type v)
 {
-    return v * nanoseconds(1000);
+    return SENF_INT2CLOCKTYPE(v * SENF_CLOCKTYPEVAL(nanoseconds(1000)));
 }
 
 prefix_ senf::ClockService::clock_type senf::ClockService::milliseconds(int64_type v)
 {
-    return v * microseconds(1000);
+    return SENF_INT2CLOCKTYPE(v * SENF_CLOCKTYPEVAL(microseconds(1000)));
 }
 
 prefix_ senf::ClockService::clock_type senf::ClockService::seconds(int64_type v)
 {
-    return v * milliseconds(1000);
+    return SENF_INT2CLOCKTYPE(v * SENF_CLOCKTYPEVAL(milliseconds(1000)));
 }
 
 prefix_ senf::ClockService::clock_type senf::ClockService::minutes(int64_type v)
 {
-    return v * seconds(60);
+    return SENF_INT2CLOCKTYPE(v * SENF_CLOCKTYPEVAL(seconds(60)));
 }
 
 prefix_ senf::ClockService::clock_type senf::ClockService::hours(int64_type v)
 {
-    return v * minutes(60);
+    return SENF_INT2CLOCKTYPE(v * SENF_CLOCKTYPEVAL(minutes(60)));
 }
 
 prefix_ senf::ClockService::clock_type senf::ClockService::days(int64_type v)
 {
-    return v * hours(24);
+    return SENF_INT2CLOCKTYPE(v * SENF_CLOCKTYPEVAL(hours(24)));
 }
 
-prefix_ senf::ClockService::clock_type senf::ClockService::in_nanoseconds(int64_type v)
+prefix_ senf::ClockService::int64_type senf::ClockService::in_nanoseconds(clock_type v)
 {
-    return v;
+    return SENF_CLOCKTYPEVAL(v);
 }
 
-prefix_ senf::ClockService::clock_type senf::ClockService::in_microseconds(int64_type v)
+prefix_ senf::ClockService::int64_type senf::ClockService::in_microseconds(clock_type v)
 {
-    return v / nanoseconds(1000);
+    return (SENF_CLOCKTYPEVAL(v) / SENF_CLOCKTYPEVAL(nanoseconds(1000)));
 }
 
-prefix_ senf::ClockService::clock_type senf::ClockService::in_milliseconds(int64_type v)
+prefix_ senf::ClockService::int64_type senf::ClockService::in_milliseconds(clock_type v)
 {
-    return v / microseconds(1000);
+    return (SENF_CLOCKTYPEVAL(v) / SENF_CLOCKTYPEVAL(microseconds(1000)));
 }
 
-prefix_ senf::ClockService::clock_type senf::ClockService::in_seconds(int64_type v)
+prefix_ senf::ClockService::int64_type senf::ClockService::in_seconds(clock_type v)
 {
-    return v / milliseconds(1000);
+    return (SENF_CLOCKTYPEVAL(v) / SENF_CLOCKTYPEVAL(milliseconds(1000)));
 }
 
-prefix_ senf::ClockService::clock_type senf::ClockService::in_minutes(int64_type v)
+prefix_ senf::ClockService::int64_type senf::ClockService::in_minutes(clock_type v)
 {
-    return v / seconds(60);
+    return (SENF_CLOCKTYPEVAL(v) / SENF_CLOCKTYPEVAL(seconds(60)));
 }
 
-prefix_ senf::ClockService::clock_type senf::ClockService::in_hours(int64_type v)
+prefix_ senf::ClockService::int64_type senf::ClockService::in_hours(clock_type v)
 {
-    return v / minutes(60);
+    return (SENF_CLOCKTYPEVAL(v) / SENF_CLOCKTYPEVAL(minutes(60))) ;
 }
 
-prefix_ senf::ClockService::clock_type senf::ClockService::in_days(int64_type v)
+prefix_ senf::ClockService::int64_type senf::ClockService::in_days(clock_type v)
 {
-    return v / hours(24);
+    return (SENF_CLOCKTYPEVAL(v) / SENF_CLOCKTYPEVAL(hours(24))) ;
 }
 
 prefix_ senf::ClockService::clock_type senf::ClockService::from_timeval(timeval const & time)
index 44ad232..40ea765 100644 (file)
@@ -40,6 +40,7 @@
 #include <senf/config.hh>
 #include <senf/Utils/singleton.hh>
 #include <senf/Utils/Console/Parse.hh>
+#include <senf/Utils/RestrictedInt.hh>
 
 //#include "ClockService.mpp"
 //-/////////////////////////////////////////////////////////////////////////////////////////////////
@@ -78,12 +79,17 @@ namespace senf {
             Unsigned integer type representing scheduler time. Scheduler time is measured in
             nanoseconds relative to some implementation defined reference time.
          */
+#ifdef SENF_DEBUG
+        struct ClockTypeTag {};
+        typedef senf::RestrictedInt<config::time_type, ClockTypeTag> clock_type;
+#else
         typedef config::time_type clock_type;
-
+#endif
         /** \brief Supplementary integer type
 
             This type is used to represent varies supplementary values (e.g. number of microseconds)
          */
+
         typedef boost::int_fast64_t int64_type;
 
         /** \brief Absolute time data type
index 72b3a31..382b908 100644 (file)
@@ -61,7 +61,7 @@ namespace {
 
 SENF_AUTO_UNIT_TEST(clockService)
 {
-    BOOST_CHECK( senf::ClockService::abstime(0).is_not_a_date_time());
+    BOOST_CHECK( senf::ClockService::abstime(senf::ClockService::clock_type(0)).is_not_a_date_time());
 
     char const * enabled (getenv("SENF_TIMING_CRITICAL_TESTS"));
     BOOST_WARN_MESSAGE(enabled, "Set SENF_TIMING_CRITICAL_TESTS to not skip timing critical tests");
index 01d68e5..97566e7 100644 (file)
@@ -170,7 +170,7 @@ prefix_ void senf::scheduler::hiresTimers()
 prefix_ senf::log::time_type senf::scheduler::LogTimeSource::operator()()
     const
 {
-    return scheduler::now();
+    return SENF_CLOCKTYPEVAL(scheduler::now());
 }
 
 //-/////////////////////////////////////////////////////////////////////////////////////////////////
index 86d61a9..201512f 100644 (file)
@@ -49,7 +49,7 @@ prefix_ senf::scheduler::TimerEvent::TimerEvent(std::string const & name, Callba
 }
 
 prefix_ senf::scheduler::TimerEvent::TimerEvent(std::string const & name, Callback const & cb)
-    : detail::FIFORunner::TaskInfo (name), cb_ (cb), timeout_ (0)
+    : detail::FIFORunner::TaskInfo (name), cb_ (cb), timeout_ (SENF_INT2CLOCKTYPE(0))
 {}
 
 prefix_ senf::scheduler::TimerEvent::~TimerEvent()
index 5f47c3c..88e2f34 100644 (file)
@@ -112,7 +112,7 @@ namespace {
     {
         //std::cerr << "diff:" << senf::ClockService::in_microseconds( senf::scheduler::now() - tm.timeout()) << '\n';
         count ++;
-        delay += senf::ClockService::in_microseconds( senf::scheduler::now() - tm.timeout());
+        delay += SENF_INT2CLOCKTYPE(senf::ClockService::in_microseconds( senf::scheduler::now() - tm.timeout()));
         haveCb = true;
         tm.timeout(randomDelay());
     }
@@ -136,7 +136,7 @@ namespace {
     void jitterTest()
     {
         count = 0;
-        delay = 0;
+        delay = senf::ClockService::clock_type(0);
 //        senf::scheduler::EventHook pre ("jitterTest::preCb", &preCb,
 //                                        senf::scheduler::EventHook::PRE);
 //        senf::scheduler::EventHook post ("jitterTest::postCb", &postCb,
@@ -158,7 +158,7 @@ namespace {
 
         senf::scheduler::process();
 
-        std::cerr << "Average scheduling delay: " << delay/count << " microseconds\n";
+        std::cerr << "Average scheduling delay: " << SENF_CLOCKTYPEVAL(delay)/count << " microseconds\n";
     }
 
 }
index 20a9e19..bdad612 100644 (file)
@@ -40,7 +40,7 @@ prefix_ senf::scheduler::TimerEventProxy<IdType>::TimerEventProxy(std::string co
     : entrySetById( entrySet.template get<Id>()),
       entrySetByTimeout( entrySet.template get<Timeout> ()),
       timer( "TimerEventProxy " + description,
-              membind(&TimerEventProxy<IdType>::timerEvent, this), 0, false)
+              membind(&TimerEventProxy<IdType>::timerEvent, this), SENF_INT2CLOCKTYPE(0), false)
 { }
 
 template<typename IdType>
@@ -93,7 +93,7 @@ prefix_ senf::ClockService::clock_type senf::scheduler::TimerEventProxy<IdType>:
     const
 {
     typename EntrySetById_t::const_iterator i ( entrySetById.find( id));
-    return i == entrySetById.end() ? 0 : i->timeout;
+    return i == entrySetById.end() ? SENF_INT2CLOCKTYPE(0) : i->timeout;
 }
 
 
index 41bacde..60002a3 100644 (file)
@@ -75,7 +75,7 @@ SENF_AUTO_UNIT_TEST(timerEventProxy)
         timers.add( now + ClockService::milliseconds(200), 1, &handler);
         BOOST_CHECK( timers.remove( 4));
         BOOST_CHECK(! timers.remove( 4));
-        BOOST_CHECK_EQUAL( timers.timeout(4), 0);
+        BOOST_CHECK_EQUAL( timers.timeout(4), SENF_INT2CLOCKTYPE(0));
         timers.add( now + ClockService::milliseconds(700), 2, &handler);
 
         BOOST_CHECK_EQUAL( timers.timeout(1), now + ClockService::milliseconds(200));
index 41479e9..2050eb7 100644 (file)
@@ -37,6 +37,7 @@
 #include TIMERFD_H_PATH
 #endif
 #include "senf/Utils/IgnoreValue.hh"
+#include <senf/Utils/ClockTypeMacros.hh>
 
 //#include "TimerSource.mpp"
 #define prefix_
@@ -93,8 +94,8 @@ senf::scheduler::detail::POSIXTimerSource::timeout(ClockService::clock_type time
 {
     if (! timeoutEnabled_ || timeout_ != timeout) {
         timeout_ = timeout;
-        if (timeout_ <= 0)
-            timeout_ = 1;
+        if (SENF_CLOCKTYPEVAL(timeout_) <= 0)
+            timeout_ = SENF_INT2CLOCKTYPE(1);
         timeoutEnabled_ = true;
         reschedule();
     }
@@ -203,8 +204,8 @@ senf::scheduler::detail::TimerFDTimerSource::timeout(ClockService::clock_type ti
 {
     if (!timeoutEnabled_ || timeout_ != timeout) {
         timeout_ = timeout;
-        if (timeout_ <= 0)
-            timeout_ = 1;
+        if (SENF_CLOCKTYPEVAL(timeout_) <= 0)
+            timeout_ = SENF_INT2CLOCKTYPE(1);
         timeoutEnabled_ = true;
         reschedule();
     }
index 2066875..4dd99a7 100644 (file)
@@ -83,7 +83,7 @@ prefix_ bool senf::FileBody::waitReadable(senf::ClockService::clock_type timeout
     const
 {
     return pollCheck(fd(), true,
-                     (timeout==-1?-1:senf::ClockService::in_milliseconds(timeout)) );
+                     (timeout==senf::ClockService::clock_type(-1)?-1:senf::ClockService::in_milliseconds(timeout)) );
 }
 
 prefix_ bool senf::FileBody::writeable()
@@ -96,7 +96,7 @@ prefix_ bool senf::FileBody::waitWriteable(senf::ClockService::clock_type timeou
     const
 {
     return pollCheck(fd(), false,
-                     (timeout==-1?-1:senf::ClockService::in_milliseconds(timeout)) );
+                     (timeout==senf::ClockService::clock_type(-1)?-1:senf::ClockService::in_milliseconds(timeout)) );
 }
 
 prefix_ bool senf::FileBody::oobReadable()
@@ -109,7 +109,7 @@ prefix_ bool senf::FileBody::waitOOBReadable(senf::ClockService::clock_type time
     const
 {
     return pollCheck(fd(), true,
-                     (timeout==-1?-1:senf::ClockService::in_milliseconds(timeout)), true);
+                     (timeout==senf::ClockService::clock_type(-1)?-1:senf::ClockService::in_milliseconds(timeout)), true);
 }
 
 //-/////////////////////////////////////////////////////////////////////////////////////////////////
index b9abd47..3d04db9 100644 (file)
@@ -135,7 +135,7 @@ namespace senf {
 
         bool readable() const;       ///< Check, whether a read on the handle would not block
                                      ///< (ignoring blocking state)
-        bool waitReadable(senf::ClockService::clock_type timeout = -1) const;
+        bool waitReadable(senf::ClockService::clock_type timeout = senf::ClockService::clock_type(-1)) const;
                                      ///< Wait, until read on the handle would not block (ignoring
                                      ///< blocking state)
                                      /**< \param[in] timeout max time to wait, default is to wait
@@ -144,7 +144,7 @@ namespace senf {
                                               timeout. */
         bool writeable() const;      ///< Check, whether a write on the handle would not block
                                      ///< (ignoring blocking state)
-        bool waitWriteable(senf::ClockService::clock_type timeout = -1) const;
+        bool waitWriteable(senf::ClockService::clock_type timeout = senf::ClockService::clock_type(-1)) const;
                                      ///< Wait, until a write on the handle would not block
                                      ///< (ignoring blocking state)
                                      /**< \param[in] timeout max time to wait, default is to wait
@@ -153,7 +153,7 @@ namespace senf {
                                               timeout. */
         bool oobReadable() const;    ///< Check, whether a read of prioritized data on the handle
                                      ///< would not block (ignoring blocking state)
-        bool waitOOBReadable(senf::ClockService::clock_type timeout = -1) const;
+        bool waitOOBReadable(senf::ClockService::clock_type timeout = senf::ClockService::clock_type(-1)) const;
                                      ///< Wait, until read of prioritized data on the handle does
                                      ///< not block (ignoring blocking state)
                                      /**< \param[in] timeout max time to wait, default is to wait
index 39e4430..020ec24 100644 (file)
@@ -35,6 +35,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
+#include <senf/Utils/ClockTypeMacros.hh>
 
 //#include "DatagramSocketProtocol.mpp"
 #define prefix_
@@ -56,7 +57,7 @@ prefix_ senf::ClockService::clock_type senf::DatagramSocketProtocol::timestamp_s
     // this may reduce the precision, but we only care about +/- 1ms, for now 
     struct timeval tv;
     ::gettimeofday( &tv, NULL);
-    return tv.tv_sec * 1000000000LL + tv.tv_usec * 1000LL;
+    return SENF_INT2CLOCKTYPE(tv.tv_sec * 1000000000LL + tv.tv_usec * 1000LL);
 }
 
 
index fba7228..6fc5895 100644 (file)
@@ -44,7 +44,7 @@
 // senf::Beeper
 
 prefix_ senf::Beeper::Beeper(std::string const & device)
-    : timer_( "senf::Beeper::timer", boost::bind(&Beeper::timeout, this), 0, false)
+    : timer_( "senf::Beeper::timer", boost::bind(&Beeper::timeout, this), SENF_INT2CLOCKTYPE(0), false)
 {
     if ((fd_ = ::open(device.c_str(), O_WRONLY)) == -1) {
         SENF_THROW_SYSTEM_EXCEPTION("Could not open device for Beeper.");
diff --git a/senf/Utils/ClockTypeMacros.hh b/senf/Utils/ClockTypeMacros.hh
new file mode 100644 (file)
index 0000000..11d64e4
--- /dev/null
@@ -0,0 +1,59 @@
+// $Id: ClockService.hh 1795 2011-07-14 08:42:24Z pba $
+//
+// Copyright (C) 2007
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+//
+// The contents of this file are subject to the Fraunhofer FOKUS Public License
+// Version 1.0 (the "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+// http://senf.berlios.de/license.html
+//
+// The Fraunhofer FOKUS Public License Version 1.0 is based on,
+// but modifies the Mozilla Public License Version 1.1.
+// See the full license text for the amendments.
+//
+// Software distributed under the License is distributed on an "AS IS" basis,
+// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+// for the specific language governing rights and limitations under the License.
+//
+// The Original Code is Fraunhofer FOKUS code.
+//
+// The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V.
+// (registered association), Hansastraße 27 c, 80686 Munich, Germany.
+// All Rights Reserved.
+//
+// Contributor(s):
+//   Philipp Batroff <philipp.batroff@fokus.fraunhofer.de>
+
+
+#ifndef HH_SENF_Utils_CLOCKTYPEMACROS
+#define HH_SENF_Utils_CLOCKTYPEMACROS_1
+
+
+#ifdef SENF_DEBUG
+#define SENF_INT2CLOCKTYPE(clock)  \
+    senf::ClockService::clock_type(clock)
+
+#define SENF_CLOCKTYPEVAL(clock) \
+    clock.value()
+#endif
+
+#ifndef SENF_DEBUG
+#define SENF_INT2CLOCKTYPE(clock)  \
+    (clock)
+#define SENF_CLOCKTYPEVAL(clock) \
+    (clock)
+#endif
+
+#endif // CLOCKTYPEMACROS_HH
+
+
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// comment-column: 40
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// End:
index 4bafdbb..24a28f4 100644 (file)
@@ -110,7 +110,7 @@ prefix_ void senf::log::detail::LogFormat::timeFormat(std::string const & format
     timeFormat_ = format;
     if (format.empty()) {
         noformat_ = true;
-        timeBase_ = ClockService::now();
+        timeBase_ = SENF_CLOCKTYPEVAL(ClockService::now());
     } else {
         noformat_ = false;
         std::locale const & loc (datestream_.getloc());
@@ -134,7 +134,7 @@ prefix_ std::string senf::log::detail::LogFormat::prefix(time_type timestamp,
                         << std::setw(9) << (delta % 1000000000ll);
         }
         else
-            datestream_ << senf::ClockService::abstime(timestamp);
+            datestream_ << senf::ClockService::abstime(SENF_INT2CLOCKTYPE(timestamp));
         datestream_ << ' ';
     }
     if (!tag_.empty())
index 59e19ee..a5aa266 100644 (file)
@@ -51,7 +51,7 @@ prefix_ senf::log::TimeSource::~TimeSource()
 prefix_ senf::log::time_type senf::log::SystemTimeSource::operator()()
     const
 {
-    return senf::ClockService::now();
+    return SENF_CLOCKTYPEVAL(senf::ClockService::now());
 }
 
 //-/////////////////////////////////////////////////////////////////////////////////////////////////
index 2bd5040..08714ac 100644 (file)
@@ -24,6 +24,7 @@
 //
 // Contributor(s):
 //   Stefan Bund <g0dil@berlios.de>
+//   Philipp Batroff <philipp.batroff@fokus.fraunhofer.de>
 
 /** \file
     \brief RestrictedInt public header */
@@ -104,6 +105,30 @@ namespace senf {
         bool boolean_test() const
             { return value_; }
 
+        RestrictedInt<Base, Tag> operator*(int i) const
+            { return RestrictedInt<Base, Tag>(value_ * i); }
+
+        RestrictedInt<Base, Tag> operator/(int i) const
+            { return RestrictedInt<Base, Tag>(value_ / i); }
+
+        bool operator>(int i) const
+            { return value_ > i; }
+
+        bool operator>=(int i) const
+            { return value_ >= i; }
+
+        bool operator<(int i) const
+            { return value_ < i; }
+
+        bool operator<=(int i) const
+            { return value_ <= i; }
+
+        bool operator==(int i) const
+            { return value_ == i; }
+
+        bool operator!=(int i) const
+            { return value_ != i; }
+
     private:
         Base value_;
     };