Files
wazero/internal/platform/time_cgo.go
Crypt Keeper 507ce79080 Adds sys.Walltime and sys.Nanotime for security and determinism (#616)
This adds two clock interfaces: sys.Walltime and sys.Nanotime to
allow implementations to override readings for purposes of security or
determinism.

The default values of both are a fake timestamp, to avoid the sandbox
break we formerly had by returning the real time. This is similar to how
we don't inherit OS Env values.
2022-06-04 15:14:31 +08:00

12 lines
266 B
Go

//go:build cgo
package platform
import _ "unsafe" // for go:linkname
// nanotime uses runtime.nanotime as it is available on all platforms and
// benchmarks faster than using time.Since.
//go:noescape
//go:linkname nanotime runtime.nanotime
func nanotime() int64