#1821 gettimeofday() with microsecond resolution

WSL
pending
Earnie Boyd
Task
later
Feature_in_WSL_4.1
True
2014-01-10
2011-05-03
Glenn Burkhardt
No

I've attached a proposal for a 'gettimeofday()' implementation that has better resolution than the current release. The current release version seems to have 15.625 ms resolution, which is the Windows clock interval. The attached version has a resolution of 1 µs on my machine.

Discussion

  •  
    Attachments
  • Earnie Boyd
    Earnie Boyd
    2013-02-14

    Ticket moved from /p/mingw/patches/482/

     
  • Earnie Boyd
    Earnie Boyd
    2013-02-14

    • labels: w32api -->
    • status: open --> pending
    • assigned_to: Earnie Boyd
    • milestone: --> WSL
    • type: --> Task
    • resolution: --> later
    • category: --> Unknown
    • patch_attached: --> True
     
  • Earnie Boyd
    Earnie Boyd
    2013-02-21

    • labels: --> needs test, needs review
    • category: Unknown --> Feature_in_WSL_4.1
     
  • Glenn Burkhardt's "gettimeofday.c" uses QueryPerformanceFrequency without checking if the return value is zero.

    The QueryPerformanceFrequency function retrieves the frequency of the high-resolution performance counter, if one exists.

    BOOL QueryPerformanceFrequency(
    LARGE_INTEGER *lpFrequency  // address of current frequency
    );
    

    Parameters

    lpFrequency

    Points to a variable that the function sets, in counts per second, to the current performance-counter frequency. If the installed hardware does not support a high-resolution performance counter, this parameter can be to zero.

    Return Values

    If the installed hardware supports a high-resolution performance counter, the return value is nonzero.
    If the installed hardware does not support a high-resolution performance counter, the return value is zero.