Skip to content

Latest commit

 

History

History
77 lines (54 loc) · 993 Bytes

README.md

File metadata and controls

77 lines (54 loc) · 993 Bytes

SYNOPSIS

Non blocking timers for C++.

USAGE

This module is designed to work with the datcxx build tool. To add this module to your project us the following command...

build add datcxx/timers

TEST

build run test

API

TIMEOUT

Hyper::Util::Timeout t;

t.start([&] {
  // timer called!
}, 1000);

TIMEOUT

Hyper::Util::Timeout t;

t.start([&] {
  // called after 1000ms.
}, 1000);

To clear a timeout use the clear() method.

t.clear();

INTERVAL

Hyper::Util::Interval i;

i.start([]() {
  // called every 1000ms.
}, 1000);

To clear an interval use the clear() method.

i.clear();

SLEEP

Put the current thread to sleep n for milliseconds.

Hyper::Util::sleep(100);

TIMER

Hyper::Util::Timer t; // starts the timer.

cout << "Milliseconds: " << t.ms(); // milliseconds since created.

t.reset(); // reset the timer.