Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PsychHID/OSX: Fix conversion of HID event timestamps to GetSecs time.
Timestamps delivered by the HID subsystem are in mach time units, arbitrary units for a given machines clock hardware. On Intel based Macs, the units happened to be fixed across all machines to be Nanoseconds, so a simple division by 1e9 did the conversion. On Apple Silicon ARM Macs, the units are no longer Nanoseconds, but something odd - probably something like bus frequency or whatever. Therefore we need to use a proper adaptive conversion, which is querying the mach timebase frequency, via PsychGetKernelTimebaseFrequencyHz() and then dividing by that. This provides proper conversion and fixes the input event timestamps of keyboard queues - KbQueueDemo now prints proper keypress times. When we are at it, make PsychGetKernelTimebaseFrequencyHz() a tad more efficient.
- Loading branch information