29 lines
895 B
C
29 lines
895 B
C
// Win32 multimedia timing entry points.
|
|
|
|
#include <stdint.h>
|
|
#include <ntlite/syscall.h>
|
|
|
|
typedef unsigned int MMRESULT;
|
|
|
|
#define MMSYSERR_NOERROR 0u
|
|
|
|
// Returns monotonic milliseconds since boot.
|
|
__declspec(dllexport) unsigned long timeGetTime(void) {
|
|
uint64_t frequency = 0;
|
|
if (SysGetTickFrequency(&frequency) != NTLSTATUS_SUCCESS || !frequency)
|
|
return 0;
|
|
return (unsigned long)SysTicksToMilliseconds(SysGetTick(), frequency);
|
|
}
|
|
|
|
// Accepts timer-resolution requests without reprogramming the native timer.
|
|
__declspec(dllexport) MMRESULT timeBeginPeriod(unsigned int periodMilliseconds) {
|
|
(void)periodMilliseconds;
|
|
return MMSYSERR_NOERROR;
|
|
}
|
|
|
|
// Releases one timer-resolution request without changing native timer policy.
|
|
__declspec(dllexport) MMRESULT timeEndPeriod(unsigned int periodMilliseconds) {
|
|
(void)periodMilliseconds;
|
|
return MMSYSERR_NOERROR;
|
|
}
|