X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FSocket%2FProtocols%2FDatagramSocketProtocol.cc;h=50c071d9074bea386845664a7c645378b926e843;hb=99c145da3884f5c20a74337927ef2cbc073d80d7;hp=fe1ec717640978b58f9dfc5b57192d8f22b4ecd2;hpb=4d345995adff65ddb6e8aca34ef5eb30ce0fe934;p=senf.git diff --git a/senf/Socket/Protocols/DatagramSocketProtocol.cc b/senf/Socket/Protocols/DatagramSocketProtocol.cc index fe1ec71..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 @@ -47,14 +47,15 @@ prefix_ senf::ClockService::clock_type senf::DatagramSocketProtocol::timestamp() 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; - if (::ioctl(fd(), SIOCGSTAMP, &tv) < 0) - SENF_THROW_SYSTEM_EXCEPTION(""); - return tv.tv_sec * 1000000000LL + tv.tv_usec * 1000; + ::gettimeofday( &tv, NULL); + return tv.tv_sec * 1000000000LL + tv.tv_usec * 1000LL; } -///////////////////////////////cc.e//////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// #undef prefix_ //#include "DatagramSocketProtocol.mpp"