aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/sys_linux_386.s
diff options
context:
space:
mode:
authorJay Weisskopf <jay@jayschwa.net>2014-02-24 10:57:46 -0500
committerRuss Cox <rsc@golang.org>2014-02-24 10:57:46 -0500
commit86c976ffd094c0326c9ba2e3d47d9cc6d73084cf (patch)
tree9ba9e40ed56c7c732a365173bf42014bd20d8a13 /src/pkg/runtime/sys_linux_386.s
parent7403071ada618d2db82b7897cce19cd1627c8831 (diff)
downloadgo-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_386.s')
-rw-r--r--src/pkg/runtime/sys_linux_386.s4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pkg/runtime/sys_linux_386.s b/src/pkg/runtime/sys_linux_386.s
index fcda739db4..cdd729957c 100644
--- a/src/pkg/runtime/sys_linux_386.s
+++ b/src/pkg/runtime/sys_linux_386.s
@@ -106,7 +106,7 @@ TEXT runtime·mincore(SB),NOSPLIT,$0-24
// func now() (sec int64, nsec int32)
TEXT time·now(SB), NOSPLIT, $32
MOVL $265, AX // syscall - clock_gettime
- MOVL $0, BX
+ MOVL $0, BX // CLOCK_REALTIME
LEAL 8(SP), CX
MOVL $0, DX
CALL *runtime·_vdso(SB)
@@ -123,7 +123,7 @@ TEXT time·now(SB), NOSPLIT, $32
// void nanotime(int64 *nsec)
TEXT runtime·nanotime(SB), NOSPLIT, $32
MOVL $265, AX // syscall - clock_gettime
- MOVL $0, BX
+ MOVL $1, BX // CLOCK_MONOTONIC
LEAL 8(SP), CX
MOVL $0, DX
CALL *runtime·_vdso(SB)