diff options
| author | Russ Cox <rsc@golang.org> | 2017-02-02 16:20:58 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2017-02-03 19:04:52 +0000 |
| commit | 0e3355903d2ebcf5ee9e76096f51ac9a116a9dbb (patch) | |
| tree | 50cba3a8521e07846222393f5045bfec0cba5ffc /src/runtime | |
| parent | 8179b9b462eb2946de8488a26dca91a89b3d22e6 (diff) | |
| download | go-0e3355903d2ebcf5ee9e76096f51ac9a116a9dbb.tar.xz | |
time: record monotonic clock reading in time.Now, for more accurate comparisons
See https://golang.org/design/12914-monotonic for details.
Fixes #12914.
Change-Id: I80edc2e6c012b4ace7161c84cf067d444381a009
Reviewed-on: https://go-review.googlesource.com/36255
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Caleb Spare <cespare@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime')
33 files changed, 68 insertions, 61 deletions
diff --git a/src/runtime/stubs.go b/src/runtime/stubs.go index 107f2604b1..616b7167ef 100644 --- a/src/runtime/stubs.go +++ b/src/runtime/stubs.go @@ -241,8 +241,7 @@ func stackBarrier() // in asm_*.s func return0() -//go:linkname time_now time.now -func time_now() (sec int64, nsec int32) +func walltime() (sec int64, nsec int32) // in asm_*.s // not called directly; definitions here supply type information for traceback. @@ -281,7 +280,7 @@ func prefetcht2(addr uintptr) func prefetchnta(addr uintptr) func unixnanotime() int64 { - sec, nsec := time_now() + sec, nsec := walltime() return sec*1e9 + int64(nsec) } diff --git a/src/runtime/sys_darwin_386.s b/src/runtime/sys_darwin_386.s index 200961f225..e911339c84 100644 --- a/src/runtime/sys_darwin_386.s +++ b/src/runtime/sys_darwin_386.s @@ -217,8 +217,8 @@ inreg: ADCL $0, DX RET -// func now() (sec int64, nsec int32) -TEXT time·now(SB),NOSPLIT,$0 +// func walltime() (sec int64, nsec int32) +TEXT runtime·walltime(SB),NOSPLIT,$0 CALL runtime·now(SB) MOVL $1000000000, CX DIVL CX diff --git a/src/runtime/sys_darwin_amd64.s b/src/runtime/sys_darwin_amd64.s index f94482856c..de8e9e37c9 100644 --- a/src/runtime/sys_darwin_amd64.s +++ b/src/runtime/sys_darwin_amd64.s @@ -198,8 +198,8 @@ TEXT runtime·nanotime(SB),NOSPLIT,$0-8 MOVQ AX, ret+0(FP) RET -// func now() (sec int64, nsec int32) -TEXT time·now(SB),NOSPLIT,$0-12 +// func walltime() (sec int64, nsec int32) +TEXT runtime·walltime(SB),NOSPLIT,$0-12 CALL nanotime<>(SB) // generated code for diff --git a/src/runtime/sys_darwin_arm.s b/src/runtime/sys_darwin_arm.s index 2c03c91683..490a410fa4 100644 --- a/src/runtime/sys_darwin_arm.s +++ b/src/runtime/sys_darwin_arm.s @@ -159,7 +159,7 @@ TEXT runtime·mincore(SB),NOSPLIT,$0 MOVW R0, ret+12(FP) RET -TEXT time·now(SB), 7, $32 +TEXT runtime·walltime(SB), 7, $32 MOVW $8(R13), R0 // timeval MOVW $0, R1 // zone MOVW $0, R2 // see issue 16570 diff --git a/src/runtime/sys_darwin_arm64.s b/src/runtime/sys_darwin_arm64.s index c02d000774..0e91d5bd10 100644 --- a/src/runtime/sys_darwin_arm64.s +++ b/src/runtime/sys_darwin_arm64.s @@ -151,7 +151,7 @@ TEXT runtime·setitimer(SB),NOSPLIT,$0 SVC $0x80 RET -TEXT time·now(SB),NOSPLIT,$40-12 +TEXT runtime·walltime(SB),NOSPLIT,$40-12 MOVD RSP, R0 // timeval MOVD R0, R9 // this is how dyld calls gettimeofday MOVW $0, R1 // zone diff --git a/src/runtime/sys_dragonfly_amd64.s b/src/runtime/sys_dragonfly_amd64.s index b950b69fe0..f355268b99 100644 --- a/src/runtime/sys_dragonfly_amd64.s +++ b/src/runtime/sys_dragonfly_amd64.s @@ -148,8 +148,8 @@ TEXT runtime·setitimer(SB), NOSPLIT, $-8 SYSCALL RET -// func now() (sec int64, nsec int32) -TEXT time·now(SB), NOSPLIT, $32 +// func walltime() (sec int64, nsec int32) +TEXT runtime·walltime(SB), NOSPLIT, $32 MOVL $232, AX // clock_gettime MOVQ $0, DI // CLOCK_REALTIME LEAQ 8(SP), SI diff --git a/src/runtime/sys_freebsd_386.s b/src/runtime/sys_freebsd_386.s index 8b6ee1f2a6..2c056feb46 100644 --- a/src/runtime/sys_freebsd_386.s +++ b/src/runtime/sys_freebsd_386.s @@ -159,8 +159,8 @@ TEXT runtime·setitimer(SB), NOSPLIT, $-4 INT $0x80 RET -// func now() (sec int64, nsec int32) -TEXT time·now(SB), NOSPLIT, $32 +// func walltime() (sec int64, nsec int32) +TEXT runtime·walltime(SB), NOSPLIT, $32 MOVL $232, AX // clock_gettime LEAL 12(SP), BX MOVL $0, 4(SP) // CLOCK_REALTIME diff --git a/src/runtime/sys_freebsd_amd64.s b/src/runtime/sys_freebsd_amd64.s index 158a60dec2..43aafe56b8 100644 --- a/src/runtime/sys_freebsd_amd64.s +++ b/src/runtime/sys_freebsd_amd64.s @@ -142,8 +142,8 @@ TEXT runtime·setitimer(SB), NOSPLIT, $-8 SYSCALL RET -// func now() (sec int64, nsec int32) -TEXT time·now(SB), NOSPLIT, $32 +// func walltime() (sec int64, nsec int32) +TEXT runtime·walltime(SB), NOSPLIT, $32 MOVL $232, AX // clock_gettime MOVQ $0, DI // CLOCK_REALTIME LEAQ 8(SP), SI diff --git a/src/runtime/sys_freebsd_arm.s b/src/runtime/sys_freebsd_arm.s index 3c5a5cbbb0..97aea65074 100644 --- a/src/runtime/sys_freebsd_arm.s +++ b/src/runtime/sys_freebsd_arm.s @@ -166,8 +166,8 @@ TEXT runtime·setitimer(SB), NOSPLIT, $-8 SWI $0 RET -// func now() (sec int64, nsec int32) -TEXT time·now(SB), NOSPLIT, $32 +// func walltime() (sec int64, nsec int32) +TEXT runtime·walltime(SB), NOSPLIT, $32 MOVW $0, R0 // CLOCK_REALTIME MOVW $8(R13), R1 MOVW $SYS_clock_gettime, R7 diff --git a/src/runtime/sys_linux_386.s b/src/runtime/sys_linux_386.s index 45320c068a..5c5afac990 100644 --- a/src/runtime/sys_linux_386.s +++ b/src/runtime/sys_linux_386.s @@ -151,8 +151,8 @@ TEXT runtime·mincore(SB),NOSPLIT,$0-16 MOVL AX, ret+12(FP) RET -// func now() (sec int64, nsec int32) -TEXT time·now(SB), NOSPLIT, $32 +// func walltime() (sec int64, nsec int32) +TEXT runtime·walltime(SB), NOSPLIT, $32 MOVL $265, AX // syscall - clock_gettime MOVL $0, BX // CLOCK_REALTIME LEAL 8(SP), CX diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s index 6ddcb30ae2..be6f396cfa 100644 --- a/src/runtime/sys_linux_amd64.s +++ b/src/runtime/sys_linux_amd64.s @@ -135,8 +135,8 @@ TEXT runtime·mincore(SB),NOSPLIT,$0-28 MOVL AX, ret+24(FP) RET -// func now() (sec int64, nsec int32) -TEXT time·now(SB),NOSPLIT,$16 +// func walltime() (sec int64, nsec int32) +TEXT runtime·walltime(SB),NOSPLIT,$16 // Be careful. We're calling a function with gcc calling convention here. // We're guaranteed 128 bytes on entry, and we've taken 16, and the // call uses another 8. diff --git a/src/runtime/sys_linux_arm.s b/src/runtime/sys_linux_arm.s index 666b879f02..1712e9d76c 100644 --- a/src/runtime/sys_linux_arm.s +++ b/src/runtime/sys_linux_arm.s @@ -197,7 +197,7 @@ TEXT runtime·mincore(SB),NOSPLIT,$0 MOVW R0, ret+12(FP) RET -TEXT time·now(SB), NOSPLIT, $32 +TEXT runtime·walltime(SB), NOSPLIT, $32 MOVW $0, R0 // CLOCK_REALTIME MOVW $8(R13), R1 // timespec MOVW $SYS_clock_gettime, R7 diff --git a/src/runtime/sys_linux_arm64.s b/src/runtime/sys_linux_arm64.s index 1b91b4499d..204aee7c51 100644 --- a/src/runtime/sys_linux_arm64.s +++ b/src/runtime/sys_linux_arm64.s @@ -182,8 +182,8 @@ TEXT runtime·mincore(SB),NOSPLIT,$-8-28 MOVW R0, ret+24(FP) RET -// func now() (sec int64, nsec int32) -TEXT time·now(SB),NOSPLIT,$24-12 +// func walltime() (sec int64, nsec int32) +TEXT runtime·walltime(SB),NOSPLIT,$24-12 MOVW $0, R0 // CLOCK_REALTIME MOVD RSP, R1 MOVD $SYS_clock_gettime, R8 diff --git a/src/runtime/sys_linux_mips64x.s b/src/runtime/sys_linux_mips64x.s index 5a75bb81ae..a4bcc72dd8 100644 --- a/src/runtime/sys_linux_mips64x.s +++ b/src/runtime/sys_linux_mips64x.s @@ -172,8 +172,8 @@ TEXT runtime·mincore(SB),NOSPLIT,$-8-28 MOVW R2, ret+24(FP) RET -// func now() (sec int64, nsec int32) -TEXT time·now(SB),NOSPLIT,$16 +// func walltime() (sec int64, nsec int32) +TEXT runtime·walltime(SB),NOSPLIT,$16 MOVW $0, R4 // CLOCK_REALTIME MOVV $0(R29), R5 MOVV $SYS_clock_gettime, R2 diff --git a/src/runtime/sys_linux_mipsx.s b/src/runtime/sys_linux_mipsx.s index 73ce06114c..3b446b15ef 100644 --- a/src/runtime/sys_linux_mipsx.s +++ b/src/runtime/sys_linux_mipsx.s @@ -175,8 +175,8 @@ TEXT runtime·mincore(SB),NOSPLIT,$0-16 MOVW R2, ret+12(FP) RET -// func now() (sec int64, nsec int32) -TEXT time·now(SB),NOSPLIT,$8-12 +// func walltime() (sec int64, nsec int32) +TEXT runtime·walltime(SB),NOSPLIT,$8-12 MOVW $0, R4 // CLOCK_REALTIME MOVW $4(R29), R5 MOVW $SYS_clock_gettime, R2 diff --git a/src/runtime/sys_linux_ppc64x.s b/src/runtime/sys_linux_ppc64x.s index a40fe3bc00..b43bda1ef2 100644 --- a/src/runtime/sys_linux_ppc64x.s +++ b/src/runtime/sys_linux_ppc64x.s @@ -157,8 +157,8 @@ TEXT runtime·mincore(SB),NOSPLIT|NOFRAME,$0-28 MOVW R3, ret+24(FP) RET -// func now() (sec int64, nsec int32) -TEXT time·now(SB),NOSPLIT,$16 +// func walltime() (sec int64, nsec int32) +TEXT runtime·walltime(SB),NOSPLIT,$16 MOVD $0, R3 // CLOCK_REALTIME MOVD $0(R1), R4 SYSCALL $SYS_clock_gettime diff --git a/src/runtime/sys_linux_s390x.s b/src/runtime/sys_linux_s390x.s index 47f34d9ea4..2291718074 100644 --- a/src/runtime/sys_linux_s390x.s +++ b/src/runtime/sys_linux_s390x.s @@ -169,8 +169,8 @@ TEXT runtime·mincore(SB),NOSPLIT|NOFRAME,$0-28 MOVW R2, ret+24(FP) RET -// func now() (sec int64, nsec int32) -TEXT time·now(SB),NOSPLIT,$16 +// func walltime() (sec int64, nsec int32) +TEXT runtime·walltime(SB),NOSPLIT,$16 MOVW $0, R2 // CLOCK_REALTIME MOVD $tp-16(SP), R3 MOVW $SYS_clock_gettime, R1 diff --git a/src/runtime/sys_nacl_386.s b/src/runtime/sys_nacl_386.s index 05de20c546..31e9b97a09 100644 --- a/src/runtime/sys_nacl_386.s +++ b/src/runtime/sys_nacl_386.s @@ -233,7 +233,7 @@ TEXT runtime·mmap(SB),NOSPLIT,$32 MOVL AX, ret+24(FP) RET -TEXT time·now(SB),NOSPLIT,$20 +TEXT runtime·walltime(SB),NOSPLIT,$20 MOVL $0, 0(SP) // real time clock LEAL 8(SP), AX MOVL AX, 4(SP) // timespec @@ -249,7 +249,7 @@ TEXT time·now(SB),NOSPLIT,$20 RET TEXT syscall·now(SB),NOSPLIT,$0 - JMP time·now(SB) + JMP runtime·walltime(SB) TEXT runtime·nacl_clock_gettime(SB),NOSPLIT,$8 MOVL arg1+0(FP), AX diff --git a/src/runtime/sys_nacl_amd64p32.s b/src/runtime/sys_nacl_amd64p32.s index c2a24e8a62..db07ae51fd 100644 --- a/src/runtime/sys_nacl_amd64p32.s +++ b/src/runtime/sys_nacl_amd64p32.s @@ -242,7 +242,7 @@ TEXT runtime·mmap(SB),NOSPLIT,$8 MOVL AX, ret+24(FP) RET -TEXT time·now(SB),NOSPLIT,$16 +TEXT runtime·walltime(SB),NOSPLIT,$16 MOVQ runtime·faketime(SB), AX CMPQ AX, $0 JEQ realtime @@ -268,7 +268,7 @@ realtime: RET TEXT syscall·now(SB),NOSPLIT,$0 - JMP time·now(SB) + JMP runtime·walltime(SB) TEXT runtime·nacl_clock_gettime(SB),NOSPLIT,$0 MOVL arg1+0(FP), DI diff --git a/src/runtime/sys_nacl_arm.s b/src/runtime/sys_nacl_arm.s index 6cbc23fd7d..aa3a09876a 100644 --- a/src/runtime/sys_nacl_arm.s +++ b/src/runtime/sys_nacl_arm.s @@ -196,7 +196,7 @@ TEXT runtime·mmap(SB),NOSPLIT,$8 MOVW R0, ret+24(FP) RET -TEXT time·now(SB),NOSPLIT,$16 +TEXT runtime·walltime(SB),NOSPLIT,$16 MOVW $0, R0 // real time clock MOVW $4(R13), R1 NACL_SYSCALL(SYS_clock_gettime) @@ -209,7 +209,7 @@ TEXT time·now(SB),NOSPLIT,$16 RET TEXT syscall·now(SB),NOSPLIT,$0 - B time·now(SB) + B runtime·walltime(SB) TEXT runtime·nacl_clock_gettime(SB),NOSPLIT,$0 MOVW arg1+0(FP), R0 diff --git a/src/runtime/sys_netbsd_386.s b/src/runtime/sys_netbsd_386.s index 8c4f004a4b..5c15794d5f 100644 --- a/src/runtime/sys_netbsd_386.s +++ b/src/runtime/sys_netbsd_386.s @@ -134,8 +134,8 @@ TEXT runtime·setitimer(SB),NOSPLIT,$-4 INT $0x80 RET -// func now() (sec int64, nsec int32) -TEXT time·now(SB), NOSPLIT, $32 +// func walltime() (sec int64, nsec int32) +TEXT runtime·walltime(SB), NOSPLIT, $32 LEAL 12(SP), BX MOVL $0, 4(SP) // arg 1 - clock_id MOVL BX, 8(SP) // arg 2 - tp diff --git a/src/runtime/sys_netbsd_amd64.s b/src/runtime/sys_netbsd_amd64.s index 7c7771bcba..c632a0b969 100644 --- a/src/runtime/sys_netbsd_amd64.s +++ b/src/runtime/sys_netbsd_amd64.s @@ -169,8 +169,8 @@ TEXT runtime·setitimer(SB),NOSPLIT,$-8 SYSCALL RET -// func now() (sec int64, nsec int32) -TEXT time·now(SB), NOSPLIT, $32 +// func walltime() (sec int64, nsec int32) +TEXT runtime·walltime(SB), NOSPLIT, $32 MOVQ $0, DI // arg 1 - clock_id LEAQ 8(SP), SI // arg 2 - tp MOVL $427, AX // sys_clock_gettime diff --git a/src/runtime/sys_netbsd_arm.s b/src/runtime/sys_netbsd_arm.s index a8914c11cb..789b12ef5b 100644 --- a/src/runtime/sys_netbsd_arm.s +++ b/src/runtime/sys_netbsd_arm.s @@ -137,8 +137,8 @@ TEXT runtime·setitimer(SB),NOSPLIT,$-4 SWI $0xa001a9 // sys_setitimer RET -// func now() (sec int64, nsec int32) -TEXT time·now(SB), NOSPLIT, $32 +// func walltime() (sec int64, nsec int32) +TEXT runtime·walltime(SB), NOSPLIT, $32 MOVW $0, R0 // CLOCK_REALTIME MOVW $8(R13), R1 SWI $0xa001ab // clock_gettime diff --git a/src/runtime/sys_openbsd_386.s b/src/runtime/sys_openbsd_386.s index 76d22b0131..b86875fd7d 100644 --- a/src/runtime/sys_openbsd_386.s +++ b/src/runtime/sys_openbsd_386.s @@ -140,8 +140,8 @@ TEXT runtime·setitimer(SB),NOSPLIT,$-4 INT $0x80 RET -// func now() (sec int64, nsec int32) -TEXT time·now(SB), NOSPLIT, $32 +// func walltime() (sec int64, nsec int32) +TEXT runtime·walltime(SB), NOSPLIT, $32 LEAL 12(SP), BX MOVL $0, 4(SP) // arg 1 - clock_id MOVL BX, 8(SP) // arg 2 - tp diff --git a/src/runtime/sys_openbsd_amd64.s b/src/runtime/sys_openbsd_amd64.s index cf7a3fb7a9..9a52e5d9ef 100644 --- a/src/runtime/sys_openbsd_amd64.s +++ b/src/runtime/sys_openbsd_amd64.s @@ -180,8 +180,8 @@ TEXT runtime·setitimer(SB),NOSPLIT,$-8 SYSCALL RET -// func now() (sec int64, nsec int32) -TEXT time·now(SB), NOSPLIT, $32 +// func walltime() (sec int64, nsec int32) +TEXT runtime·walltime(SB), NOSPLIT, $32 MOVQ $0, DI // arg 1 - clock_id LEAQ 8(SP), SI // arg 2 - tp MOVL $87, AX // sys_clock_gettime diff --git a/src/runtime/sys_openbsd_arm.s b/src/runtime/sys_openbsd_arm.s index f573a028a0..93a5d5b7f6 100644 --- a/src/runtime/sys_openbsd_arm.s +++ b/src/runtime/sys_openbsd_arm.s @@ -150,8 +150,8 @@ TEXT runtime·setitimer(SB),NOSPLIT,$0 SWI $0 RET -// func now() (sec int64, nsec int32) -TEXT time·now(SB), NOSPLIT, $32 +// func walltime() (sec int64, nsec int32) +TEXT runtime·walltime(SB), NOSPLIT, $32 MOVW CLOCK_REALTIME, R0 // arg 1 - clock_id MOVW $8(R13), R1 // arg 2 - tp MOVW $87, R12 // sys_clock_gettime diff --git a/src/runtime/sys_plan9_386.s b/src/runtime/sys_plan9_386.s index 41aa2fd982..6baa8138d6 100644 --- a/src/runtime/sys_plan9_386.s +++ b/src/runtime/sys_plan9_386.s @@ -102,8 +102,8 @@ TEXT runtime·nsec(SB),NOSPLIT,$8 MOVL $-1, ret_hi+8(FP) RET -// func now() (sec int64, nsec int32) -TEXT time·now(SB),NOSPLIT,$8-12 +// func walltime() (sec int64, nsec int32) +TEXT runtime·walltime(SB),NOSPLIT,$8-12 CALL runtime·nanotime(SB) MOVL 0(SP), AX MOVL 4(SP), DX diff --git a/src/runtime/sys_plan9_amd64.s b/src/runtime/sys_plan9_amd64.s index 149505fa7e..d7bd92c1b4 100644 --- a/src/runtime/sys_plan9_amd64.s +++ b/src/runtime/sys_plan9_amd64.s @@ -92,8 +92,8 @@ TEXT runtime·nsec(SB),NOSPLIT,$0 MOVQ AX, ret+8(FP) RET -// func now() (sec int64, nsec int32) -TEXT time·now(SB),NOSPLIT,$8-12 +// func walltime() (sec int64, nsec int32) +TEXT runtime·walltime(SB),NOSPLIT,$8-12 CALL runtime·nanotime(SB) MOVQ 0(SP), AX diff --git a/src/runtime/sys_plan9_arm.s b/src/runtime/sys_plan9_arm.s index d54f56f132..f5c5e18de0 100644 --- a/src/runtime/sys_plan9_arm.s +++ b/src/runtime/sys_plan9_arm.s @@ -139,7 +139,7 @@ TEXT runtime·nsec(SB),NOSPLIT,$-4-12 RET // time.now() (sec int64, nsec int32) -TEXT time·now(SB),NOSPLIT,$12-12 +TEXT runtime·walltime(SB),NOSPLIT,$12-12 // use nsec system call to get current time in nanoseconds MOVW $sysnsec_lo-8(SP), R0 // destination addr MOVW R0,res-12(SP) diff --git a/src/runtime/sys_solaris_amd64.s b/src/runtime/sys_solaris_amd64.s index c542db3986..aeb2e2c897 100644 --- a/src/runtime/sys_solaris_amd64.s +++ b/src/runtime/sys_solaris_amd64.s @@ -354,8 +354,8 @@ TEXT runtime·osyield1(SB),NOSPLIT,$0 CALL AX RET -// func now() (sec int64, nsec int32) -TEXT time·now(SB),NOSPLIT,$8-12 +// func walltime() (sec int64, nsec int32) +TEXT runtime·walltime(SB),NOSPLIT,$8-12 CALL runtime·nanotime(SB) MOVQ 0(SP), AX diff --git a/src/runtime/sys_windows_386.s b/src/runtime/sys_windows_386.s index bd5de33946..42583dd106 100644 --- a/src/runtime/sys_windows_386.s +++ b/src/runtime/sys_windows_386.s @@ -432,8 +432,8 @@ TEXT runtime·switchtothread(SB),NOSPLIT,$0 MOVL BP, SP RET -// func now() (sec int64, nsec int32) -TEXT time·now(SB),NOSPLIT,$8-12 +// func walltime() (sec int64, nsec int32) +TEXT runtime·walltime(SB),NOSPLIT,$8-12 CALL runtime·unixnano(SB) MOVL 0(SP), AX MOVL 4(SP), DX diff --git a/src/runtime/sys_windows_amd64.s b/src/runtime/sys_windows_amd64.s index c61b79d24f..56079f6aa3 100644 --- a/src/runtime/sys_windows_amd64.s +++ b/src/runtime/sys_windows_amd64.s @@ -465,8 +465,8 @@ TEXT runtime·switchtothread(SB),NOSPLIT|NOFRAME,$0 MOVQ 32(SP), SP RET -// func now() (sec int64, nsec int32) -TEXT time·now(SB),NOSPLIT,$8-12 +// func walltime() (sec int64, nsec int32) +TEXT runtime·walltime(SB),NOSPLIT,$8-12 CALL runtime·unixnano(SB) MOVQ 0(SP), AX diff --git a/src/runtime/time.go b/src/runtime/time.go index 604ccded89..98057534c0 100644 --- a/src/runtime/time.go +++ b/src/runtime/time.go @@ -301,3 +301,11 @@ func net_runtimeNano() int64 { func time_runtimeNano() int64 { return nanotime() } + +var startNano = nanotime() + +//go:linkname time_now time.now +func time_now() (sec int64, nsec int32, mono uint64) { + sec, nsec = walltime() + return sec, nsec, uint64(nanotime() - startNano + 1) +} |
