to

Converts a TickDuration to the given units as either an integral value or a floating point value.

T
to
@safe pure nothrow @nogc
(
string units
T
D
)
(
D td
)
if (
is(_Unqual!D == TickDuration) &&
(
units == "seconds" ||
units == "msecs"
||
units == "usecs"
||
units == "hnsecs"
||
units == "nsecs"
)
)

Parameters

units

The units to convert to. Accepts "seconds" and smaller only.

T

The type to convert to (either an integral type or a floating point type).

td
Type: D

The TickDuration to convert

Examples

1 auto t = TickDuration.from!"seconds"(1000);
2 
3 long tl = to!("seconds",long)(t);
4 assert(tl == 1000);
5 
6 double td = to!("seconds",double)(t);
7 assert(_abs(td - 1000) < 0.001);
Suggestion Box / Bug Report