diff options
Diffstat (limited to 'libgo/go/runtime/time_fake.go')
-rw-r--r-- | libgo/go/runtime/time_fake.go | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/libgo/go/runtime/time_fake.go b/libgo/go/runtime/time_fake.go index c64d2994a90..c790faba3d6 100644 --- a/libgo/go/runtime/time_fake.go +++ b/libgo/go/runtime/time_fake.go @@ -2,20 +2,13 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build faketime -// +build !windows - -// Faketime isn't currently supported on Windows. This would require: -// -// 1. Shadowing time_now, which is implemented in assembly on Windows. -// Since that's exported directly to the time package from runtime -// assembly, this would involve moving it from sys_windows_*.s into -// its own assembly files build-tagged with !faketime and using the -// implementation of time_now from timestub.go in faketime mode. -// -// 2. Modifying syscall.Write to call syscall.faketimeWrite, -// translating the Stdout and Stderr handles into FDs 1 and 2. -// (See CL 192739 PS 3.) +//go:build faketime && !windows +// +build faketime,!windows + +// Faketime isn't currently supported on Windows. This would require +// modifying syscall.Write to call syscall.faketimeWrite, +// translating the Stdout and Stderr handles into FDs 1 and 2. +// (See CL 192739 PS 3.) package runtime @@ -44,8 +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) { + return faketime / 1e9, int32(faketime % 1e9), faketime } func write(fd uintptr, p unsafe.Pointer, n int32) int32 { |