Closed alanbernstein closed 7 years ago
This is a very long thread, and I'm still reading, but I believe this issue may be solved (or solved soon) within Go's time package: https://github.com/golang/go/issues/12914
Seems like it is in 1.9 - basically, time.Now() will internally include both wall time and monotonic information, and will use whichever is more appropriate for a given situation - so doing time.Sub
or time.Since
will use the monotonic time, and we won't need to update our code at all.
I'm gonna go ahead and close this - feel free to re-open if there are still concerns.
time.Now()
returns real time, which can jump occasionally. https://github.com/gavv/monotime, for example, provides a monotonicNow()
function, which is preferable for timing measurements.