View source code
Display the source code in core/time.d from which this page was generated on
github.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Page wiki
View or edit the community-maintained wiki page associated with this page.
Function core.time.to
Converts a TickDuration
to
the given units as either an integral
value or a floating point value.
Prototype
T to(string units, T, D)( D td ) pure nothrow @nogc @safe if (is(_Unqual!D == TickDuration) && (units == "seconds" || units == "msecs" || units == "usecs" || units == "hnsecs" || units == "nsecs"));
Parameters
Name | Description |
---|---|
units | The units to convert to . Accepts " and smaller
only. |
T | The type to convert to (either an integral type or a
floating point type).
|
td | The TickDuration to convert |
Example
auto t = TickDuration.from!"seconds"(1000); long tl = to!("seconds",long)(t); assert(tl == 1000); double td = to!("seconds",double)(t); assert(_abs(td - 1000) < 0.001);
Authors
Jonathan M Davis and Kato Shoichi