monotonicclock

package
v0.0.0-...-bc518a9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package monotonicclock represents the imported interface "wasi:clocks/monotonic-clock@0.2.1".

WASI Monotonic Clock is a clock API intended to let users measure elapsed time.

It is intended to be portable at least between Unix-family platforms and Windows.

A monotonic clock is a clock which has an unspecified initial value, and successive reads of the clock will produce non-decreasing values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Duration

type Duration uint64

Duration represents the u64 "wasi:clocks/monotonic-clock@0.2.1#duration".

A duration of time, in nanoseconds.

type duration = u64

func Resolution

func Resolution() (result Duration)

Resolution represents the imported function "resolution".

Query the resolution of the clock. Returns the duration of time corresponding to a clock tick.

resolution: func() -> duration

type Instant

type Instant uint64

Instant represents the u64 "wasi:clocks/monotonic-clock@0.2.1#instant".

An instant in time, in nanoseconds. An instant is relative to an unspecified initial value, and can only be compared to instances from the same monotonic-clock.

type instant = u64

func Now

func Now() (result Instant)

Now represents the imported function "now".

Read the current value of the clock.

The clock is monotonic, therefore calling this function repeatedly will produce a sequence of non-decreasing values.

now: func() -> instant

type Pollable

type Pollable = poll.Pollable

Pollable represents the imported type alias "wasi:clocks/monotonic-clock@0.2.1#pollable".

See poll.Pollable for more information.

func SubscribeDuration

func SubscribeDuration(when Duration) (result Pollable)

SubscribeDuration represents the imported function "subscribe-duration".

Create a `pollable` that will resolve after the specified duration has elapsed from the time this function is invoked.

subscribe-duration: func(when: duration) -> pollable

func SubscribeInstant

func SubscribeInstant(when Instant) (result Pollable)

SubscribeInstant represents the imported function "subscribe-instant".

Create a `pollable` which will resolve once the specified instant has occurred.

subscribe-instant: func(when: instant) -> pollable

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL