time: Fix UWP build
parent
650ba8f3ec
commit
a00ac61514
|
@ -79,14 +79,20 @@ found_date:
|
||||||
|
|
||||||
int SDL_GetCurrentTime(SDL_Time *ticks)
|
int SDL_GetCurrentTime(SDL_Time *ticks)
|
||||||
{
|
{
|
||||||
static pfnGetSystemTimePreciseAsFileTime pGetSystemTimePreciseAsFileTime = NULL;
|
|
||||||
static SDL_bool load_attempted = SDL_FALSE;
|
|
||||||
FILETIME ft;
|
FILETIME ft;
|
||||||
|
|
||||||
if (!ticks) {
|
if (!ticks) {
|
||||||
return SDL_InvalidParamError("ticks");
|
return SDL_InvalidParamError("ticks");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SDL_zero(ft);
|
||||||
|
|
||||||
|
#ifdef SDL_PLATFORM_WINRT
|
||||||
|
GetSystemTimePreciseAsFileTime(&ft);
|
||||||
|
#else
|
||||||
|
static pfnGetSystemTimePreciseAsFileTime pGetSystemTimePreciseAsFileTime = NULL;
|
||||||
|
static SDL_bool load_attempted = SDL_FALSE;
|
||||||
|
|
||||||
/* Only available in Win8/Server 2012 or higher. */
|
/* Only available in Win8/Server 2012 or higher. */
|
||||||
if (!pGetSystemTimePreciseAsFileTime && !load_attempted) {
|
if (!pGetSystemTimePreciseAsFileTime && !load_attempted) {
|
||||||
HANDLE kernel32 = GetModuleHandle(TEXT("kernel32.dll"));
|
HANDLE kernel32 = GetModuleHandle(TEXT("kernel32.dll"));
|
||||||
|
@ -96,12 +102,13 @@ int SDL_GetCurrentTime(SDL_Time *ticks)
|
||||||
load_attempted = SDL_TRUE;
|
load_attempted = SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_zero(ft);
|
|
||||||
if (pGetSystemTimePreciseAsFileTime) {
|
if (pGetSystemTimePreciseAsFileTime) {
|
||||||
pGetSystemTimePreciseAsFileTime(&ft);
|
pGetSystemTimePreciseAsFileTime(&ft);
|
||||||
} else {
|
} else {
|
||||||
GetSystemTimeAsFileTime(&ft);
|
GetSystemTimeAsFileTime(&ft);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
*ticks = SDL_TimeFromWindows(ft.dwLowDateTime, ft.dwHighDateTime);
|
*ticks = SDL_TimeFromWindows(ft.dwLowDateTime, ft.dwHighDateTime);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue