Source file src/runtime/time_nofake.go
1 // Copyright 2019 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 //go:build !faketime 6 7 package runtime 8 9 import "unsafe" 10 11 // faketime is the simulated time in nanoseconds since 1970 for the 12 // playground. 13 // 14 // Zero means not to use faketime. 15 var faketime int64 16 17 //go:nosplit 18 func nanotime() int64 { 19 return nanotime1() 20 } 21 22 // overrideWrite allows write to be redirected externally, by 23 // linkname'ing this and set it to a write function. 24 // 25 //go:linkname overrideWrite 26 var overrideWrite func(fd uintptr, p unsafe.Pointer, n int32) int32 27 28 // write must be nosplit on Windows (see write1) 29 // 30 //go:nosplit 31 func write(fd uintptr, p unsafe.Pointer, n int32) int32 { 32 if overrideWrite != nil { 33 return overrideWrite(fd, noescape(p), n) 34 } 35 return write1(fd, p, n) 36 } 37