| 1 |
// Copyright 2025 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 !windows |
| 6 |
|
| 7 |
package time |
| 8 |
|
| 9 |
import "time" |
| 10 |
|
| 11 |
var start = time.Now() |
| 12 |
|
| 13 |
// HighPrecisionNow returns a high-resolution timestamp suitable for measuring |
| 14 |
// small time differences. It uses the time package's monotonic clock. |
| 15 |
// |
| 16 |
// Its unit, epoch, and resolution are unspecified, and may change, but can be |
| 17 |
// assumed to be sufficiently precise to measure time differences on the order |
| 18 |
// of tens to hundreds of nanoseconds. |
| 19 |
func HighPrecisionNow() int64 { |
| 20 |
return int64(time.Since(start)) |
| 21 |
} |