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
{{ message }}
This repository has been archived by the owner on Oct 21, 2023. It is now read-only.
Go does not currently provide one (See: golang/go#12914). While it is assumed that all mixes will run NTP or similar, the scheduling should be resilient to the system clock changing, thus using time.Now() is unacceptable.
There's a few ways to do this, such as exposing runtime.nanotime() with unsafe trickery, or by calling clock_gettime() since the only OS that this actually matters on is Linux.
The text was updated successfully, but these errors were encountered:
The timer routines in time use runtime.nanotime(), which on Linux is backed by CLOCK_MONOTONIC. As long as the core scheduling only ever uses absolute time based timing things, this shouldn't be a problem, but I suppose we want to be able to measure time differences (eg: packet queue times) via subtraction.
I opted against exposing the Go `runtime.nanotime()` routine using
unsafe trickery and instead did something far more horrific out of NIH
and wanting `CLOCK_MONOTONIC_RAW` instead of `CLOCK_MONOTONIC`.
Caveats:
* This is quite a bit slower than what I could do if I cribbed or
exposed the runtime routine, but the vDSO stuff is still a win. This
is primarily an implementation difference (I use the stack more, and
do more math).
* I didn't write code to parse the symbol versions.
* vDSO support is Linux AMD64 only.
Fixes#6
Go does not currently provide one (See: golang/go#12914). While it is assumed that all mixes will run NTP or similar, the scheduling should be resilient to the system clock changing, thus using
time.Now()
is unacceptable.There's a few ways to do this, such as exposing
runtime.nanotime()
with unsafe trickery, or by callingclock_gettime()
since the only OS that this actually matters on is Linux.The text was updated successfully, but these errors were encountered: