trivial-timer

2019-05-21

Trivial Timer Manual

[in package TRIVIAL-TIMER]

pipeline status Quicklisp coverage report

Description

Trivial Timer allows for easy scheduling of tasks (functions). The default tolerance is +- 10ms as defined by *ms-tolerance*.

Installing trivial-timer

This project is available in the latest QuickLisp distribution, so installing it is reduced to calling:

(ql:quickload :trivial-timer)

Working Example

(in-package :trivial-timer)
(initialize-timer)

(defun timer-callback (registered-time delay)
  (log:info "I was called by the timer ~a ms after registration. Expected was ~a ms."
    (- (get-internal-real-time) registered-time) delay))

(let ((delay 1000))
  (register-timer-call delay #'timer-callback))

=> I was called by the timer 992 ms after registration. Expected was 1000 ms.

Exported Symbols

  • [variable] MS-TOLERANCE 10

    Time tolerance (default +/- 10ms)

  • [function] INITIALIZE-TIMER

    Initialization of trivial-timer. This MUST be called before any other function from this library.

  • [function] SHUTDOWN-TIMER

    Shutdown the timer. No further calls can be registered. Atention: Stopping is an asynchronous request, meaning that some registered call might still be executed after calling shutdown-timer

  • [function] REGISTER-TIMER-CALL OFFSET CALL

    Register a function call to be executed in offset milliseconds from now.

  • [function] REGISTER-TIMER-RECURRING-CALL OFFSET CALL

    Register a function call to be (recurrently) executed every offset milliseconds.

License Information

This library is released under the MIT License. Please refer to the LICENSE to get the full licensing text.

Contributing to this project

Please refer to the CONTRIBUTING document for more information.