The OpenD Programming Language

ticksToNSecs

Convenience wrapper around convClockFreq which converts ticks at a clock frequency of MonoTime.ticksPerSecond to nanoseconds.

It's primarily of use when MonoTime.ticksPerSecond is greater than hecto-nanosecond resolution, and an application needs a higher precision than hecto-nanoceconds.

@safe pure nothrow @nogc
long
ticksToNSecs
(
long ticks
)

Examples

auto before = MonoTime.currTime;
// do stuff
auto after = MonoTime.currTime;
auto diffInTicks = after.ticks - before.ticks;
auto diffInNSecs = ticksToNSecs(diffInTicks);
assert(diffInNSecs == convClockFreq(diffInTicks, MonoTime.ticksPerSecond, 1_000_000_000));

See Also

Meta