timespec on windows compilers

后端 未结 2 1821
北荒
北荒 2021-01-22 16:54

On posix it is possible to use timespec to calculate accurate time length (like seconds and milliseconds). Unfortunately I need to migrate to windows with Visual Studio compiler

2条回答
  •  旧时难觅i
    2021-01-22 17:27

    Depends on what sort of accuracy you want, my understanding is that clock and time_t are not accurate to the millisecond level. Similarly GetTickCount() is commonly used (MS docs say accurate to 10-15ms) but not sufficiently accurate for many purposes.

    I use QueryPerformanceFrequency and QueryPerformanceCounter for accurate timing measurements for performance.

提交回复
热议问题