View source code
Display the source code in core/time.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
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.

Function core.time.convClockFreq

Converts the given time from one clock frequency/resolution to another.

long convClockFreq (
  long ticks,
  long srcTicksPerSecond,
  long dstTicksPerSecond
) pure nothrow @nogc @safe;

See Also

ticksToNSecs

Example

// one tick is one second -> one tick is a hecto-nanosecond
writeln(convClockFreq(45, 1, 10_000_000)); // 450_000_000

// one tick is one microsecond -> one tick is a millisecond
writeln(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
writeln(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

License

Boost License 1.0.