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.

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

Examples

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

See Also

Suggestion Box / Bug Report