You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Re: CFGetSystemUptime — use CLOCK_UPTIME for BSD, and QueryUnbiasedInterruptTimePrecise for Windows?
CLOCK_MONOTONIC is the correct choice for Linux and Cygwin, because it excludes system "downtime" on those platforms.
CLOCK_UPTIME is available on FreeBSD and OpenBSD, so it might be a better option for TARGET_OS_BSD.
GetTickCount64 may include system "downtime", and the result is in milliseconds, which might not be precise enough. For example, ProcessInfo.processInfo.systemUptime is currently used by swift-corelibs-xctest.
Just something to think about since I brushed up against this recently: on OpenBSD at least, CLOCK_MONOTONIC and CLOCK_UPTIME are reasonably close, but a lot of Foundation uses MONOTONIC which Dispatch may interpret as UPTIME since it is trying to do stuff like clock inference (c.f. https://github.com/apple/swift-corelibs-libdispatch/blob/f13ea5dcc055e5d2d7c02e90d8c9907ca9dc72e1/src/shims/time.h#L257). I don't have any solutions or ideas for this right now, but it's something interesting to think about.
Additional Detail from JIRA
md5: 69fb038c8490173be7492fcf9739e539
Issue Description:
Re: CFGetSystemUptime — use
CLOCK_UPTIME
for BSD, andQueryUnbiasedInterruptTimePrecise
for Windows?CLOCK_MONOTONIC
is the correct choice for Linux and Cygwin, because it excludes system "downtime" on those platforms.CLOCK_UPTIME
is available on FreeBSD and OpenBSD, so it might be a better option forTARGET_OS_BSD
.GetTickCount64 may include system "downtime", and the result is in milliseconds, which might not be precise enough. For example,
ProcessInfo.processInfo.systemUptime
is currently used by swift-corelibs-xctest.QueryUnbiasedInterruptTimePrecise excludes system "downtime", and the result is in 100-nanosecond units. It is also used by Cygwin and Dispatch for the same purpose.
The text was updated successfully, but these errors were encountered: