[ovs-dev] [PATCH 1/2] timeval: clock_gettime() for Windows.

Ben Pfaff blp at nicira.com
Tue Mar 4 16:55:09 UTC 2014


On Mon, Mar 03, 2014 at 02:46:27PM -0800, Gurucharan Shetty wrote:
> QueryPerformanceCounter() retrieves the current value of the performance
> counter, which is a high resolution (<1us) time stamp that can be used for
> time-interval measurements. So, use it for MONOTONIC clock.
> 
> The GetSystemTimePreciseAsFileTime() function retrieves the current system date
> and time with the highest possible level of precision (<1us). Use it for
> real time clock. This function returns a counter representing the number of
> 100-nanosecond intervals since January 1, 1601. To make it compatible with
> Linux CLOCK_REALTIME, we need to calculate the 100-nanoseconds counter value
> till 01/01/1970.
> 
> An upcoming commit implements gettimeofday() using the same clock, so,
> carve out a function.
> 
> Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>

Does this compile?  clock_gettime() is declared "void" but contains a
statement "return -1;"

clockid_t, CLOCK_MONOTONIC, and CLOCK_REALTIME are only used inside
timeval.c so I'd prefer to declare them there rather than in timeval.h.

Thanks,

Ben.



More information about the dev mailing list