nupp.time.spi

Implementation interfaces consumed during ordinary module initialization. Discover with nupp.spi.load; the consumer chooses the unique highest priority. Omitted priority is zero. Importing these declarations loads no implementation.

Module contents

Types

TypeKindDescription
ProviderinterfaceClocks and cancellable waits, measured in milliseconds.

Types#

Providerinterface#

interface Provider ...

Clocks and cancellable waits, measured in milliseconds.

now is monotonic with an unspecified origin; wallTime is Unix epoch time and must not be used for monotonic deadlines. wakeAt and sleepUntil use the same origin as now. Finite non-negative durations and deadlines are required. Waits cooperate with the selected suspension implementation. Timer callbacks and cancellation functions belong to the current Lua state.

Members

NameKindDescription
priorityfield
wakeAtmethodSchedules a deadline callback and returns its cancellation function.
nowmethodReturns monotonic milliseconds used for durations and deadlines.
wallTimemethodReturns milliseconds since the Unix epoch.
sleepmethodWaits for a relative interval through the current suspension context.
sleepUntilmethodWaits until an absolute deadline in the now clock domain.

priorityfield#

priority: integer?
@readonly

wakeAtmethod#

wakeAt: function(deadline: number, resume: function(boolean): nil): function(): nil
@readonly

Schedules a deadline callback and returns its cancellation function. Registration itself must not suspend the subscriber.

Arguments
NameTypeDescription
deadlinenumber
resumefunction(boolean): nil
Returns
TypeDescription
function(): nil

nowmethod#

now: function(): number
@readonly

Returns monotonic milliseconds used for durations and deadlines.

Returns
TypeDescription
number

wallTimemethod#

wallTime: function(): number
@readonly

Returns milliseconds since the Unix epoch.

Returns
TypeDescription
number

sleepmethod#

sleep: function(milliseconds: number): nil
@readonly

Waits for a relative interval through the current suspension context.

Arguments
NameTypeDescription
millisecondsnumber
Returns
TypeDescription
nil

sleepUntilmethod#

sleepUntil: function(deadline: number): nil
@readonly

Waits until an absolute deadline in the now clock domain.

Arguments
NameTypeDescription
deadlinenumber
Returns
TypeDescription
nil