wa-lang.org/wazero@v1.0.2/sys/clock.go (about)

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