The OpenD Programming Language

convClockFreq

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

@safe pure nothrow @nogc
long
convClockFreq

Examples

// 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);

See Also

Meta