timer 0.6.1

A simple countdown timer


To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

This package provides sub packages which can be used individually:

timer:countdown - Simple countdown timer example

timer:stopwatch - Simple stopwatch timer example

Dub version Build Status Dub download Status

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

Authors:
  • Orfeo Da Viá
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
Show all 9 versions
Download Stats:
  • 0 downloads today

  • 1 downloads this week

  • 1 downloads this month

  • 215 downloads total

Score:
0.4
Short URL:
timer.dub.pm