ezEngine  Milestone 7
Time_osx.h
1 
2 #include <CoreServices/CoreServices.h>
3 #include <mach/mach.h>
4 #include <mach/mach_time.h>
5 
6 static mach_timebase_info_data_t g_TimebaseInfo;
7 
8 void ezTime::Initialize()
9 {
10  mach_timebase_info(&g_TimebaseInfo);
11 }
12 
14 {
15  // mach_absolute_time() returns nanoseconds after factoring in the mach_timebase_info_data_t
16  return ezTime::Seconds( (double)((mach_absolute_time() * g_TimebaseInfo.numer) / g_TimebaseInfo.denom) / 1000000000LL);
17 }
18