-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: APM
-
None
Summary
bson_get_monotonic_time() uses GetTickCount64 on Windows, which appears to have a resolution in the range of 10-16 milliseconds. This is actually quite a bit worse than what I originally assumed reading the libbson code, which implies that the returned value is just milliseconds.
This came up while fixing some command monitoring tests on Windows for PHPC-2143. We had a few tests that assert a non-zero duration for a commandFailed or commandSucceeded event, and I noticed that these tests occasionally fail (presumably when the calculated duration is less than GetTickCount64's resolution.
Given this limitation, is there an alternative that would make more sense on Windows? Is command monitoring the only likely case where diffing two bson_get_monotonic_time() return values might evaluate to zero? If not, perhaps bson_gettimeofday would make a better fallback.
Environment
- libmongoc 1.23.1
- Windows Server 2019 64-bit
- MSVC15 (Visual C++ 2017) x64
How to Reproduce
Example script: commandSucceededEvent-001.phpt
- is related to
-
PHPC-2143 Add Windows builds to GitHub Actions and publish DLLs for releases
- Closed