nogcsw 0.1.0

Simple stopwatch timer implementation for D (-betterC, @nogc)


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:

nogcsw

Simple stopwatch timer implementation for D (-betterC, @nogc)

Use below subconfiguration for betterC in your dub.json

"subConfigurations": {
        "nogcsw": "nogc"
}

Examples:

    import core.stdc.stdio : printf;
    import nogcsw;

    {
        auto sw = StopWatch(false);
        assert(sw.elapsed!"usecs" == 0);
        sw.start();

        sw.sleep!"seconds"(1);
        assert(sw.elapsed!"seconds" == 1);
        sw.stop();

        printf("#1: Elapsed time: %lu usecs\n", sw.elapsed!"usecs");
    }

    {
        auto sw = StopWatch(true);

        sw.sleep!"usecs"(10);
        assert(sw.elapsed!"usecs" >= 10);
        sw.stop();

        printf("#2: Elapsed time: %lu usecs\n", sw.elapsed!"usecs");
    }

    {
        auto sw = StopWatch(true);

        sw.sleep!"msecs"(2);
        assert(sw.elapsed!"msecs" == 2);
        assert(sw.running() == true);
        sw.stop();

        printf("#3: Elapsed time: %lu usecs\n", sw.elapsed!"usecs");
    }

Authors:
  • Alexander Chepkov
Dependencies:
none
Versions:
0.1.2 2025-Mar-01
0.1.1 2025-Feb-28
0.1.0 2025-Feb-28
Show all 3 versions
Download Stats:
  • 0 downloads today

  • 1 downloads this week

  • 7 downloads this month

  • 7 downloads total

Score:
0.5
Short URL:
nogcsw.dub.pm