added a timestamp_system() to return the system's wallclock time (NTP synced)
mtk [Mon, 30 Aug 2010 19:29:53 +0000 (19:29 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1704 270642c3-0616-0410-b53a-bc976706d245

senf/Socket/Protocols/DatagramSocketProtocol.cc
senf/Socket/Protocols/DatagramSocketProtocol.hh

index d9ec0b4..fe1ec71 100644 (file)
@@ -44,6 +44,16 @@ prefix_ senf::ClockService::clock_type senf::DatagramSocketProtocol::timestamp()
     return ClockService::from_timeval(tv);
 }
 
+prefix_ senf::ClockService::clock_type senf::DatagramSocketProtocol::timestamp_system()
+    const
+{
+    struct timeval tv;
+    if (::ioctl(fd(), SIOCGSTAMP, &tv) < 0)
+        SENF_THROW_SYSTEM_EXCEPTION("");
+    return tv.tv_sec * 1000000000LL + tv.tv_usec * 1000;
+}
+
+
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_
 //#include "DatagramSocketProtocol.mpp"
index 84368a3..5aa460d 100644 (file)
@@ -45,6 +45,8 @@ namespace senf {
         : public virtual SocketProtocol
     {
     public:
+        ClockService::clock_type timestamp_system() const; ///< Return packet timestamp of last packet
+
         ClockService::clock_type timestamp() const; ///< Return packet timestamp of last packet
                                         /**< The returned timestamp represents the time, at which
                                              the last network packet passed to the user has been