September 17, 2015 Pretty Printing TickDuration | ||||
|---|---|---|---|---|
| ||||
Currently
import std.datetime: StopWatch;
StopWatch sw;
sw.start;
writeln(sw.peek());
prints for instance
TickDuration(279483)
I've seen Phobos doing something much more clever such as pretty printing of time in the format:
1 hour, 2 seconds, 3 milliseconds, etc.
How do I convert an instance of `TickDuration` to that format?
| ||||
September 17, 2015 Re: Pretty Printing TickDuration | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | On Thursday, 17 September 2015 at 16:54:02 UTC, Nordlöw wrote:
> How do I convert an instance of `TickDuration` to that format?
Solution:
writeln("> Query took ", sw.peek().to!Duration);
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply