Converting Duration to TickDuration
Jonathan M Davis
jmdavisProg at gmx.com
Mon Sep 12 19:01:31 PDT 2011
On Tuesday, September 13, 2011 04:32:28 Vladimir Panteleev wrote:
> The simplest way I found is:
> TickDuration.from!"hnsecs"(duration.total!"hnsecs")
>
> Is there a simpler way?
I don't believe so. A TickDuration can be cast (or use std.conv.to) to convert
to a Duration, but there is no cast in the opposite direction. One could be
added (and perhaps it should be), but I do find it a bit odd to convert from
Duration to TickDuration. Usually, you'd get a TickDuration from timing stuff
(like benchmarking or some other type of stopwatch functionality), and I would
expect creating TickDurations in other ways to be fairly rare. What are you
doing that you want to create a TickDuration from a Duration?
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list