Lumenarium/src_v2/platform/osx/lumenarium_osx_time.h

22 lines
444 B
C
Raw Normal View History

2022-04-16 11:00:32 +00:00
// I think this SO post might be helpful
// https://stackoverflow.com/questions/30575995/multi-platform-equivalent-to-queryperformancecounter
Ticks
os_get_ticks()
{
Ticks result = {
.value = mach_absolute_time()
};
return result;
}
r64
os_get_ticks_per_second()
{
mach_timebase_info_data_t info;
mach_timebase_info(&info);
r64 to_nanos = (r64)info.numer / (r64)info.denom;
r64 to_secs = to_nanos / 10e9;
return to_secs;
}