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.convClockFreq
Converts the given time from one clock frequency/resolution to
another.
Prototype
long convClockFreq( long ticks, long srcTicksPerSecond, long dstTicksPerSecond ) pure nothrow @nogc @safe;
See Also
Example
// one tick is one second -> one tick is a hecto-nanosecond assert(convClockFreq(45, 1, 10_000_000) == 450_000_000); // one tick is one microsecond -> one tick is a millisecond assert(convClockFreq(9029, 1_000_000, 1_000) == 9); // one tick is 1/3_515_654 of a second -> 1/1_001_010 of a second assert(convClockFreq(912_319, 3_515_654, 1_001_010) == 259_764); // one tick is 1/MonoTime.ticksPerSecond -> one tick is a nanosecond // Equivalent to ticksToNSecs auto nsecs = convClockFreq(1982, MonoTime.ticksPerSecond, 1_000_000_000);
Authors
Jonathan M Davis and Kato Shoichi