timer 0.4.1
A simple countdown timer
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
This package provides sub packages which can be used individually:
timer:countdown - Simple countdown timer example
timer:stopwatch - Simple stopwatch timer example
timer
A simple D implementation of countdown and stopwatch timer
Usage
StopWatchTimer
import core.thread;
import std.stdio;
import timer;
void main(string[] args) {
StopWatchTimer sw;
sw.start();
Thread.sleep(dur!("msecs")(200));
sw.stop();
writefln("elapsed %s", sw.elapsed);
sw.reset();
writefln("after reset elapsed %d ms", sw.elapsedMsecs);
writeln();
writeln("restart...");
sw.restart();
Thread.sleep(dur!("msecs")(150));
writefln("After restart elapsed %d ms", sw.elapsedMsecs);
}
CountdownTimer
import core.thread;
import std.stdio;
import timer;
void main(string[] args) {
Countdown countms;
countms.start(200);
while (!countms.isOver) {
Thread.sleep(dur!("msecs")(10));
writefln("elapsed %7.3f ms remaining %7.3f ms", countms.elapsedTime, countms.remainingTime);
}
}
Examples can be found in the examples directory, and ran with dub run timer:stopwatch
or dub run timer:countdown
or finally with make:
$ cd examples
$ make
Libraries
License
Distributed under the Boost Software License, Version 1.0
- Registered by o3o
- 0.4.1 released 7 years ago
- o3o/timer
- Boost
- Copyright © 2016, Orfeo Da Viá
- Authors:
- Sub packages:
- timer:countdown, timer:stopwatch
- Dependencies:
- none
- Versions:
-
0.6.1 2018-Apr-12 0.6.0 2018-Mar-01 0.5.0 2018-Jan-24 0.4.1 2017-Jul-26 0.4.0 2017-Jul-25 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
242 downloads total
-
- Score:
- 0.8
- Short URL:
- timer.dub.pm