Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
runtime: start nanotime at runtime start #22436
Currently the zero value of
More discussion in #22394.
referenced this issue
Oct 25, 2017
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.