-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Library can measure negative times #9
Comments
Fascinating. 🍿! I like how the test in aristanetworks/goarista@46272bf looks to be probabilistic, I guess you'd have to actually mess with the system time or do some horrendous mocking to pull off a deterministic test though. And interesting that this conversation flared up again because Cloudflare had some downtime due to it. In general though, absent an admin messing with the system time, are time leaping and DST type of events the main places where this would cause a problem? |
(I'm using this library: https://godoc.org/github.com/aristanetworks/goarista/monotime) |
(In the grand scheme of things I doubt this matters much since I'm pretty confident the system can tolerate a negative time measurement. But it's good to do the right thing) |
I wrote more about it here https://kev.inburke.com/kevin/leap-seconds/ |
A monotonic clock is probably coming in Go 1.9 golang/go#12914 |
🙌 that's awesome |
Occasionally the duration reported by calling
a := time.Now(); b := time.Now(); c := b.Since(a)
can be negative, since Go does not use a monotonic clock source fortime.Now()
calls. This affected production code after the leap second yesterday. This is being discussed at e.g. golang/go#12914 but it might be good to consider switching to something like https://godoc.org/github.com/davecheney/junk/clock in the meantime.I'm still researching this issue.
The text was updated successfully, but these errors were encountered: