]> Cypherpunks repositories - gostls13.git/commit
runtime: use mach_absolute_time for runtime.nanotime
authorLars Wiegman <lars@namsral.com>
Tue, 17 Jan 2017 10:38:18 +0000 (11:38 +0100)
committerRuss Cox <rsc@golang.org>
Thu, 2 Feb 2017 21:20:40 +0000 (21:20 +0000)
commite546b295b8a3b6f8996a02aeecfbdfedd07c21aa
tree1d67c5457950ac221c039f5808ea7e222e4880ea
parent8958d8ce37fdae15693787019869ab21e7b8347a
runtime: use mach_absolute_time for runtime.nanotime

The existing darwin/amd64 implementation of runtime.nanotime returns the
wallclock time, which results in timers not functioning properly when
system time runs backwards. By implementing the algorithm used by the
darwin syscall mach_absolute_time, timers will function as expected.

The algorithm is described at
https://opensource.apple.com/source/xnu/xnu-3248.60.10/libsyscall/wrappers/mach_absolute_time.s

Fixes #17610

Change-Id: I9c8d35240d48249a6837dca1111b1406e2686f67
Reviewed-on: https://go-review.googlesource.com/35292
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/runtime/sys_darwin_amd64.s