# `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. ## Types ### `Provider` _interface_ ```nupp 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 | Name | Kind | Description | | --- | --- | --- | | [`priority`](#nupp.time.spi.Provider.priority) | field | | | [`wakeAt`](#nupp.time.spi.Provider.wakeAt) | method | Schedules one deadline callback and returns its cancellation function. | | [`now`](#nupp.time.spi.Provider.now) | method | Returns monotonic milliseconds used for durations and deadlines. | | [`wallTime`](#nupp.time.spi.Provider.wallTime) | method | Returns milliseconds since the Unix epoch. | | [`sleep`](#nupp.time.spi.Provider.sleep) | method | Waits for a relative interval through the current suspension context. | | [`sleepUntil`](#nupp.time.spi.Provider.sleepUntil) | method | Waits until an absolute deadline in the now clock domain. | #### `priority` _field_ ```nupp priority: integer? ``` `@readonly` #### `wakeAt` _method_ ```nupp wakeAt: function(deadline: number, resume: function(boolean): nil): function(): nil ``` `@readonly` Schedules one deadline callback and returns its cancellation function. Registration itself must not suspend the subscriber. ##### Arguments | Name | Type | Description | | --- | --- | --- | | `deadline` | `number` | | | `resume` | `function(boolean): nil` | | ##### Returns | Type | Description | | --- | --- | | `function(): nil` | | #### `now` _method_ ```nupp now: function(): number ``` `@readonly` Returns monotonic milliseconds used for durations and deadlines. ##### Returns | Type | Description | | --- | --- | | `number` | | #### `wallTime` _method_ ```nupp wallTime: function(): number ``` `@readonly` Returns milliseconds since the Unix epoch. ##### Returns | Type | Description | | --- | --- | | `number` | | #### `sleep` _method_ ```nupp sleep: function(milliseconds: number): nil ``` `@readonly` Waits for a relative interval through the current suspension context. ##### Arguments | Name | Type | Description | | --- | --- | --- | | `milliseconds` | `number` | | ##### Returns | Type | Description | | --- | --- | | `nil` | | #### `sleepUntil` _method_ ```nupp sleepUntil: function(deadline: number): nil ``` `@readonly` Waits until an absolute deadline in the now clock domain. ##### Arguments | Name | Type | Description | | --- | --- | --- | | `deadline` | `number` | | ##### Returns | Type | Description | | --- | --- | | `nil` | |