#include <mach/mach_time.h>

mach/mach_time.h Kernel.framework

includes: mach/mach_types.h, sys/cdefs.h, Availability.h
4 functions

functionmach_approximate_time

uint64_t mach_approximate_time(void)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu libsyscall/wrappers/mach_approximate_time.c, libsyscall/wrappers/mach_approximate_time.s
Returns an approximation of mach_absolute_time, in the same mach absolute time units. When the commpage advertises APPROX_TIME_SUPPORTED, the value is read from a periodically updated commpage field, avoiding the cost of reading the hardware time base; the result may therefore lag the precise clock slightly. On configurations without commpage support the call falls back to mach_absolute_time exactly. Like mach_absolute_time, the clock does not advance while the system is asleep; mach_continuous_approximate_time is the variant that does.

functionmach_continuous_time

uint64_t mach_continuous_time(void)
like mach_absolute_time, but advances during sleep

functionmach_continuous_approximate_time

uint64_t mach_continuous_approximate_time(void)
like mach_approximate_time, but advances during sleep

functionmach_continuous_speculative_time

uint64_t mach_continuous_speculative_time(void)
variant of mach_continuous_time that uses speculative timebase