github.com/bananabytelabs/wazero@v0.0.0-20240105073314-54b22a776da8/sys/clock.go (about) 1 package sys 2 3 // ClockResolution is a positive granularity of clock precision in 4 // nanoseconds. For example, if the resolution is 1us, this returns 1000. 5 // 6 // Note: Some implementations return arbitrary resolution because there's 7 // no perfect alternative. For example, according to the source in time.go, 8 // windows monotonic resolution can be 15ms. See /RATIONALE.md. 9 type ClockResolution uint32 10 11 // Walltime returns the current unix/epoch time, seconds since midnight UTC 12 // 1 January 1970, with a nanosecond fraction. 13 type Walltime func() (sec int64, nsec int32) 14 15 // Nanotime returns nanoseconds since an arbitrary start point, used to measure 16 // elapsed time. This is sometimes referred to as a tick or monotonic time. 17 // 18 // Note: There are no constraints on the value return except that it 19 // increments. For example, -1 is a valid if the next value is >= 0. 20 type Nanotime func() int64 21 22 // Nanosleep puts the current goroutine to sleep for at least ns nanoseconds. 23 type Nanosleep func(ns int64) 24 25 // Osyield yields the processor, typically to implement spin-wait loops. 26 type Osyield func()