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
Currently the zero value of runtime.nanotime means different things on different systems. On some, it's system boot time, on others it's program start time. We should make it measure time from program start on all platforms for consistency. Then we can also eliminate runtimeInitTime. (If we do this, we should also make it harder to call nanotime too early in runtime init, either by panicking if the program start time isn't established or by establishing program start time much earlier during init.)
Re last bit, initializing startTime explicitly in runtime.schedinit SGTM. At that point the only worry is that osinit might refer to nanotime, but that seems very unlikely.
This was obviated by a1ee0a2, which moved startNano out of the runtime and into the time package. So now nanotime is consistent on all platforms in that it doesn't start at zero. See @dvyukov's argument in a1ee0a2 for why this makes more sense.
Moving startNano out of the runtime fixed the issue where calling nanotime too early (before startNano was set) led to a confusing and potentially buggy shift in time. There's some danger it could legitimately return a zero value, leading to issue #22394, but this will only happen once in 584 years, and typically nanotime's base is system boot time anyway.
Currently the zero value of
runtime.nanotime
means different things on different systems. On some, it's system boot time, on others it's program start time. We should make it measure time from program start on all platforms for consistency. Then we can also eliminateruntimeInitTime
. (If we do this, we should also make it harder to callnanotime
too early in runtime init, either by panicking if the program start time isn't established or by establishing program start time much earlier during init.)More discussion in #22394.
The text was updated successfully, but these errors were encountered: