On Apr 26 20:00, Christian Franke wrote:
> System calls and resolutions of C++11 clocks:
> 
>                                Mingw-w64 MSVC16  Cygwin
> system_clock::now()               1        2       2
> steady_clock::now()               1        3       3
> high_resolution_clock::now()      1        3       3
> 
> where
> 1: GetSystemTimeAsFileTime: >15ms to 1ms (unpredictable)
> 2: GetSystemTimePreciseAsFileTime: <1us
> 3: QueryPerformanceCounter: <500ns

Not quite.  Newer Windows versions support better alternatives compared
to QueryPerformanceCounter.  Thus on newer systems Cygwin uses

  QueryUnbiasedInterruptTimePrecise     for CLOCK_MONOTONIC{_RAW}
  QueryUnbiasedInterruptTime            for CLOCK_MONOTONIC_COARSE
  QueryInterruptTimePrecise             for CLOCK_BOOTTIME{_ALARM}

and, of course

  GetSystemTimePreciseAsFileTime        for CLOCK_REALTIME
  GetSystemTimeAsFileTime               for CLOCK_REALTIME_COARSE

Apart from style issues, I vote for using GetSystemTimePreciseAsFileTime
for CLOCK_REALTIME and only fall back to GetSystemTimeAsFileTime for
CLOCK_REALTIME_COARSE or if the OS doesn't support the precise call.

Please do keep in mind that there are assumptions of a minimum 
precision of gettimeofday in the wild, which are not really in our
hands.  If we can avoid upstream code to #ifdef time computations
for Mingw separately, rather than just using gettimeofday on all
supported platforms, it's certainly a win-win, isn't it?


Corinna



_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to