Out of data wiki

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Apr 18 14:18:56 PDT 2017


On Tuesday, April 18, 2017 19:54:26 Mike B Johnson via Digitalmars-d-learn 
wrote:
> can this be updated to work?
>
> https://wiki.dlang.org/Timing_Code

Wow, that's using some old stuff - stuff older than the wiki. Weird. It was
probably ported from somewhere.

The best thing to use now is core.time.MonoTime. e.g.

MonoTime before = MonoTime.currTime();
...
MonoTime after = MonoTime.currTime();
Duration diff = before - after;

There are also some benchmarking functions in std.datetime, but they use
TickDuration (which is slated to be deprecated) and need to be replaced with
versions that use MonoTime.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list