timeval: clock_gettime() for Windows.
authorGurucharan Shetty <gshetty@nicira.com>
Mon, 3 Mar 2014 21:27:35 +0000 (13:27 -0800)
committerGurucharan Shetty <gshetty@nicira.com>
Wed, 5 Mar 2014 16:38:18 +0000 (08:38 -0800)
commit48f8613f26a90e133ff3fce2fe16053dcaabc957
tree7fd8cec9b27b060188aa939c2d4c96a29b6d1ed7
parent5020f5f099526ec224ba0b1703806b42ebdaee5a
timeval: clock_gettime() for Windows.

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@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
lib/timeval.c