X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FSocket%2FProtocols%2FDatagramSocketProtocol.cc;h=50c071d9074bea386845664a7c645378b926e843;hb=7661548b20e6c7627f54bff87e0758396fd523ef;hp=d9ec0b4686245a08ab3d48350d211237308d2db4;hpb=601d1f509f5bb24df167a4dd5a20da67a0af9af8;p=senf.git diff --git a/senf/Socket/Protocols/DatagramSocketProtocol.cc b/senf/Socket/Protocols/DatagramSocketProtocol.cc index d9ec0b4..50c071d 100644 --- a/senf/Socket/Protocols/DatagramSocketProtocol.cc +++ b/senf/Socket/Protocols/DatagramSocketProtocol.cc @@ -33,7 +33,7 @@ //#include "DatagramSocketProtocol.mpp" #define prefix_ -///////////////////////////////cc.p//////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// prefix_ senf::ClockService::clock_type senf::DatagramSocketProtocol::timestamp() const @@ -44,7 +44,18 @@ prefix_ senf::ClockService::clock_type senf::DatagramSocketProtocol::timestamp() return ClockService::from_timeval(tv); } -///////////////////////////////cc.e//////////////////////////////////////// +prefix_ senf::ClockService::clock_type senf::DatagramSocketProtocol::timestamp_system() + const +{ + // we use gettimeofday() here, since on some boxes the above ioctl() return bogus values. + // 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; +} + + +//-///////////////////////////////////////////////////////////////////////////////////////////////// #undef prefix_ //#include "DatagramSocketProtocol.mpp"