to

TickDuration is DEPRECATED

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

deprecated @safe pure nothrow @nogc
T
to
(
string units
T
D
)
(
D td
)
if (
is(immutable D == immutable 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 D

The TickDuration to convert

Examples

auto t = TickDuration.from!"seconds"(1000);

long tl = to!("seconds",long)(t);
assert(tl == 1000);

import core.stdc.math : fabs;
double td = to!("seconds",double)(t);
assert(fabs(td - 1000) < 0.001);

Meta