[Live-devel] minor bug on windows implementation of gettimeofday()

Ross Finlayson finlayson at live555.com
Wed Apr 1 17:08:23 PDT 2009


>Over in GroupSockHelper.cpp is a windows implementation of gettimeofday(). 
>There are three implementations for it -- one for CE (?), one that uses
>ftime() and another that uses QueryPerformanceCounter().
>
>The version that uses QueryPerformanceCounter() is broken.  With that
>implementation, the epoch of the returned times is variant -- seemns to be
>last-boot.  gettimeofday() is supposed to return wall clock times with an
>invariant epoch.  The ftime() implementation should be used on windows
>instead, which one gets by compiling the library with the
>USE_OLD_GETTIMEOFDAY_FOR_WINDOWS_CODE symbol defined.

The "QueryPerformaceCounter()" code was introduced - in October 2006 
- in response to an email by Dave Arnold, complaining that the old, 
"ftime()"-based implementation was insufficiently precise.  See 
<http://lists.live555.com/pipermail/live-devel/2006-October/005288.html>. 
For this reason, I don't want to go back to making the old 
implementation the default.  Instead, I'd rather fix the current 
implementation, if we can.

Unfortunately I'm not an expert on Windoze-specific API stuff. 
(Unfortunately Dave Arnold no longer appears to be on this mailing 
list.)  Is there any other Windows function - other than "ftime()" - 
that returns a correct time, based on a fixed epoch?  (If not, then 
the only possible fix I can think of would be to call "ftime()" just 
once - for the first call to "gettimeofday()" - to get a fixed 'epoch 
adjustment' that would be added to the subsequent times returned by 
"QueryPerformaceCounter()".)
-- 

Ross Finlayson
Live Networks, Inc.
http://www.live555.com/


More information about the live-devel mailing list