system.timer - Palamecia/mint GitHub Wiki

Module system.timer

Description

load system.timer

This module provides the System.Timer class which provides an awaitable timer implementation.

Packages

Enums

System.Timer.ClockType

This enum describe the clock precision.

| Constant | Value | Description ||----------|-------|-------------|

| Monotonic | 0 | |

Classes

System.Timer

This class provides an awaitable timer implementation that trigger an event when the timer timeout.

The timer's clock can be adjusted by using a value of the System.Timer.ClockType enum.

This type is not copyable

Public members

Modifiers Member Description
enum ClockType This enum describe the clock precision.
const clear Resets the timeout event.
const getDelay Returns the timer delay in milliseconds as a number.
const getHandle Returns the handle used by System.Timer.System.Poller.
const getPeriod Returns the timer period in milliseconds as a number.
const getPollEvent Returns the event's poll event as an instance of mint::poll_event_t.
const isPeriodic Returns true if the timer is periodic; otherwise returns false.
const isRunning Returns true if the timer is running; otherwise returns false.
const new Creates a new timer. The created timer is not started. The clockType can be a...
const reset Reset the internal event state
const restart Restarts the timer with the same timeout delay than the previous call to Syst...
const start Starts or restarts a timer that will timeout after a delay of delay milliseco...
const stop Stops the timer.
const wait Waits until the timer timeout. If timeout is given, the wait stop after timeout...

Private members

Modifiers Member Description
const clone Disable object copy.
final d_ptr Object data.
final delay Internal timer delay.
@ const g_lib Global library handle.
final period Internal timer period.

Descriptions

System.Timer.ClockType.Monotonic

0

System.Timer.clear

def (self)

Resets the timeout event.

System.Timer.clone

none

Disable object copy.

System.Timer.d_ptr

null

Object data.

System.Timer.delay

none

Internal timer delay.

System.Timer.g_lib

lib ('libmint-system')

Global library handle.

System.Timer.getDelay

def (const self)

Returns the timer delay in milliseconds as a number.

System.Timer.getHandle

def (const self)

Returns the handle used by System.Poller.

System.Timer.getPeriod

def (const self)

Returns the timer period in milliseconds as a number.

System.Timer.getPollEvent

def (const self)

Returns the event's poll event as an instance of mint::poll_event_t.

System.Timer.isPeriodic

def (const self)

Returns true if the timer is periodic; otherwise returns false.

System.Timer.isRunning

def (const self)

Returns true if the timer is running; otherwise returns false.

System.Timer.new

def (self, clockType = System.Timer.ClockType.Monotonic)

Creates a new timer. The created timer is not started.

The clockType can be a value of System.Timer.ClockType that describe the timer's clock precision.

If no timer can be created, none is returned.

System.Timer.period

none

Internal timer period.

System.Timer.reset

def (self)

Reset the internal event state

System.Timer.restart

def (self)

Restarts the timer with the same timeout delay than the previous call to start. The timeout event is reset.

Returns true if a previous timeout delay can be found; otherwise false is returned and the timer is not started.

System.Timer.start

def (self, delay)

Starts or restarts a timer that will timeout after a delay of delay milliseconds.

def (self, delay, period)

Starts or restarts a timer that will timeout after a delay of delay milliseconds then every period milliseconds.

System.Timer.stop

def (self)

Stops the timer.

System.Timer.wait

def (self, timeout = none)

Waits until the timer timeout. If timeout is given, the wait stop after timeout milliseconds if the timer has still not timed out.

Returns true if the timer timed out; otherwise returns false if the wait timed out.

After a call to this method, the event is reset.