timed ~master

A simple timer utility


To use this package, run the following command in your project's root directory:

Timed

A simple time utility library

import timed : setInterval, stopInterval;

import std.stdio : writeln;
import std.datetime : seconds;
import core.thread.osthread : Thread;

void main()
{
	// "tid" of type Tid can be referenced 
	// to stop setInterval()
	auto tid = setInterval(1000, { writeln("tick"); });
	auto tid2 = setInterval(3000, { writeln("tock"); });
	Thread.sleep(12.seconds);

	// stop running setInterval()
	stopInterval(tid);
	stopInterval(tid2);
}

To-do

  • [x] Proper setInterval with cancellation
  • [ ] setTimeout
Authors:
  • Lawrence Aberba
Dependencies:
none
Versions:
0.0.2 2020-Jun-28
0.0.1 2020-Jun-27
~master 2020-Jun-28
Show all 3 versions
Download Stats:
  • 0 downloads today

  • 2 downloads this week

  • 3 downloads this month

  • 3 downloads total

Score:
0.4
Short URL:
timed.dub.pm