//go:build faketime && !windows
// +build faketime,!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.)
+// 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
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()
+}
+
func write(fd uintptr, p unsafe.Pointer, n int32) int32 {
if !(fd == 1 || fd == 2) {
// Do an ordinary write.
// Declarations for operating systems implementing time.now
// indirectly, in terms of walltime and nanotime assembly.
-//go:build !windows
-// +build !windows
+//go:build !faketime && !windows
+// +build !faketime,!windows
package runtime