best D equivalent to C'stimeval
Marco Leise
Marco.Leise at gmx.de
Mon Mar 31 10:50:22 PDT 2014
Am Mon, 31 Mar 2014 05:09:22 +0000
schrieb "ed" <sillymongrel at gmail.com>:
> Hi,
>
> Just wondering what the best replacement for C timeval is in D.
> I'm looking at std.datetime.SysTime, but std.datetime is huge so
> I'm not sure.
>
> Thanks,
> ed
If you just need to time something, TickDuration from
core.time is an efficient cross-platform timer.
auto t1 = TickDuration.currentSystemTick;
...
auto t2 = TickDuration.currentSystemTick;
writefln("Took %s ms", (t2-t1).msecs);
--
Marco
More information about the Digitalmars-d-learn
mailing list