clock: Bug fix: Use float64 not to overflow

Bug: #862
This commit is contained in:
Hajime Hoshi 2019-05-09 01:14:46 +09:00
parent 93426fd84e
commit c65d035cc9

View File

@ -58,5 +58,7 @@ var (
func now() int64 {
// Use the time duration instead of the current counter to avoid overflow.
duration := queryPerformanceCounter() - initCtr
return (duration * 1e9) / freq
// Use float64 not to overflow int64 values (#862).
return int64(float64(duration) / float64(freq) * 1e9)
}