| 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 |
var overrideWrite func(fd uintptr, p unsafe.Pointer, n int32) int32 |
| 23 |
|
| 24 |
// write must be nosplit on Windows (see write1) |
| 25 |
// |
| 26 |
//go:nosplit |
| 27 |
func write(fd uintptr, p unsafe.Pointer, n int32) int32 { |
| 28 |
if overrideWrite != nil { |
| 29 |
return overrideWrite(fd, noescape(p), n) |
| 30 |
} |
| 31 |
return write1(fd, p, n) |
| 32 |
} |