From: mtk Date: Mon, 30 Aug 2010 19:29:53 +0000 (+0000) Subject: added a timestamp_system() to return the system's wallclock time (NTP synced) X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=4d345995adff65ddb6e8aca34ef5eb30ce0fe934;p=senf.git added a timestamp_system() to return the system's wallclock time (NTP synced) git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1704 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/senf/Socket/Protocols/DatagramSocketProtocol.cc b/senf/Socket/Protocols/DatagramSocketProtocol.cc index d9ec0b4..fe1ec71 100644 --- a/senf/Socket/Protocols/DatagramSocketProtocol.cc +++ b/senf/Socket/Protocols/DatagramSocketProtocol.cc @@ -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" diff --git a/senf/Socket/Protocols/DatagramSocketProtocol.hh b/senf/Socket/Protocols/DatagramSocketProtocol.hh index 84368a3..5aa460d 100644 --- a/senf/Socket/Protocols/DatagramSocketProtocol.hh +++ b/senf/Socket/Protocols/DatagramSocketProtocol.hh @@ -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