MCPcopy Create free account
hub / github.com/360Controller/360Controller / CurrentTimeUsingMach

Function CurrentTimeUsingMach

Feedback360/Feedback360.cpp:34–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32#define LoopGranularity 10000 // Microseconds
33
34double CurrentTimeUsingMach()
35{
36 static mach_timebase_info_data_t info = {0};
37 if (!info.denom)
38 {
39 if (mach_timebase_info(&info) != KERN_SUCCESS)
40 {
41 //Generally it can't fail here. Look at XNU sources //FIXME
42 info.denom = 0;
43 return -1.0;
44 }
45 }
46
47 uint64_t start = mach_absolute_time();
48
49 uint64_t nanos = start * info.numer / info.denom;
50 return (double)nanos / NSEC_PER_SEC;
51}
52
53static IOCFPlugInInterface functionMap360_IOCFPlugInInterface = {
54 // Padding required for COM

Callers 5

CalcMethod · 0.70
StartEffectMethod · 0.70
DownloadEffectMethod · 0.70
EffectProcMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected