;; WASI Clocks. ;; ;; Some content here is derived from [CloudABI](https://github.com/NuxiNL/cloudabi). ;; ;; This is a `witx` file. See [here](https://github.com/WebAssembly/WASI/tree/master/docs/witx.md) ;; for an explanation of what that means. (use "typenames.witx") (module $wasi_ephemeral_clock ;;; Linear memory to be accessed by WASI functions that need it. (import "memory" (memory)) ;;; Return the resolution of a clock. ;;; Implementations are required to provide a non-zero value for supported clocks. For unsupported clocks, ;;; return `errno::inval`. ;;; Note: This is similar to `clock_getres` in POSIX. (@interface func (export "res_get") (result $error $errno) ;;; The clock for which to return the resolution. (param $id $clockid) ;;; The resolution of the clock. (result $resolution $timestamp) ) ;;; Return the time value of a clock. ;;; Note: This is similar to `clock_gettime` in POSIX. (@interface func (export "time_get") ;;; The clock for which to return the time. (param $id $clockid) ;;; The maximum lag (exclusive) that the returned time value may have, compared to its actual value. (param $precision $timestamp) (result $error $errno) ;;; The time value of the clock. (result $time $timestamp) ) )