1
0
mirror of https://github.com/golang/go synced 2024-11-26 07:38:00 -07:00

runtime: remove walltime function

There was only one meaningful caller, which changes to call time_now.

This clearly separates systems that use walltime1 to be just those
that use the stub version of time_now. That is to say, those that do
not provide an assembler version of time_now.

Change-Id: I14c06cc402070bd705f953af6f9966785015e2a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/314769
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
Ian Lance Taylor 2021-04-28 11:10:07 -07:00
parent d09947522d
commit 42953bc9f5
4 changed files with 3 additions and 12 deletions

View File

@ -37,14 +37,9 @@ func nanotime() int64 {
return faketime
}
func walltime() (sec int64, nsec int32) {
return faketime / 1000000000, int32(faketime % 1000000000)
}
//go:linkname time_now time.now
func time_now() (sec int64, nsec int32, mono int64) {
sec, nsec = walltime()
return sec, nsec, nanotime()
return faketime / 1e9, int32(faketime % 1e9), faketime
}
func write(fd uintptr, p unsafe.Pointer, n int32) int32 {

View File

@ -20,10 +20,6 @@ func nanotime() int64 {
return nanotime1()
}
func walltime() (sec int64, nsec int32) {
return walltime1()
}
// write must be nosplit on Windows (see write1)
//
//go:nosplit

View File

@ -16,6 +16,6 @@ import _ "unsafe" // for go:linkname
//go:linkname time_now time.now
func time_now() (sec int64, nsec int32, mono int64) {
sec, nsec = walltime()
sec, nsec = walltime1()
return sec, nsec, nanotime()
}

View File

@ -144,7 +144,7 @@ func writeLogdHeader() int {
// hdr[3:7] sec unsigned uint32, little endian.
// hdr[7:11] nsec unsigned uint32, little endian.
hdr[0] = 0 // LOG_ID_MAIN
sec, nsec := walltime()
sec, nsec, _ := time_now()
packUint32(hdr[3:7], uint32(sec))
packUint32(hdr[7:11], uint32(nsec))