StopWatch problem
Joel
joelcnz at gmail.com
Tue Dec 5 22:23:17 UTC 2017
On Tuesday, 5 December 2017 at 21:45:20 UTC, Jonathan M Davis
wrote:
> On Tuesday, December 05, 2017 21:33:53 Joel via
> Digitalmars-d-learn wrote:
>> [...]
>
> core.time.msecs is an alias for core.time.dur!"msecs". It takes
> a long for the number of milliseconds and returns a Duration.
> If you want to convert a Duration to milliseconds, then use its
> member function, total. e.g. sw.peek.total!"msecs". It will
> convert the hnsecs in the duration to msecs using integral math
> and return a long.
>
> If what you want is a floating point value like
> TickDuration.msecs does,
> then you'll have to do the math yourself with something like
> sw.peek.total!"hnsecs" / cast(real)convert!("seconds",
> "hnsecs")(1).
>
> https://dlang.org/phobos/core_time.html#.msecs
> https://dlang.org/phobos/core_time.html#.Duration.total
>
> - Jonathan M Davis
Got it, thanks.
More information about the Digitalmars-d-learn
mailing list