diff options
| author | Jay Weisskopf <jay@jayschwa.net> | 2014-02-24 10:57:46 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2014-02-24 10:57:46 -0500 |
| commit | 86c976ffd094c0326c9ba2e3d47d9cc6d73084cf (patch) | |
| tree | 9ba9e40ed56c7c732a365173bf42014bd20d8a13 /src/pkg/runtime/sys_linux_amd64.s | |
| parent | 7403071ada618d2db82b7897cce19cd1627c8831 (diff) | |
| download | go-86c976ffd094c0326c9ba2e3d47d9cc6d73084cf.tar.xz | |
runtime: use monotonic clock for timers (linux/386, linux/amd64)
This lays the groundwork for making Go robust when the system's
calendar time jumps around. All input values to the runtimeTimer
struct now use the runtime clock as a common reference point.
This affects net.Conn.Set[Read|Write]Deadline(), time.Sleep(),
time.Timer, etc. Under normal conditions, behavior is unchanged.
Each platform and architecture's implementation of runtime·nanotime()
should be modified to use a monotonic system clock when possible.
Platforms/architectures modified and tested with monotonic clock:
linux/x86 - clock_gettime(CLOCK_MONOTONIC)
Update #6007
LGTM=dvyukov, rsc
R=golang-codereviews, dvyukov, alex.brainman, stephen.gutekanst, dave, rsc, mikioh.mikioh
CC=golang-codereviews
https://golang.org/cl/53010043
Diffstat (limited to 'src/pkg/runtime/sys_linux_amd64.s')
| -rw-r--r-- | src/pkg/runtime/sys_linux_amd64.s | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pkg/runtime/sys_linux_amd64.s b/src/pkg/runtime/sys_linux_amd64.s index 481841a674..74dc871db7 100644 --- a/src/pkg/runtime/sys_linux_amd64.s +++ b/src/pkg/runtime/sys_linux_amd64.s @@ -136,7 +136,7 @@ TEXT runtime·nanotime(SB),NOSPLIT,$16 MOVQ runtime·__vdso_clock_gettime_sym(SB), AX CMPQ AX, $0 JEQ fallback_gtod_nt - MOVL $0, DI // CLOCK_REALTIME + MOVL $1, DI // CLOCK_MONOTONIC LEAQ 0(SP), SI CALL AX MOVQ 0(SP), AX // sec |
