Convert ticks to 64-bit, added nanosecond precision to the API
Fixes https://github.com/libsdl-org/SDL/issues/5512 Fixes https://github.com/libsdl-org/SDL/issues/6731
This commit is contained in:
@@ -30,12 +30,12 @@
|
||||
#if !TARGET_OS_TV
|
||||
/* turn off the battery monitor if it's been more than X ms since last check. */
|
||||
static const int BATTERY_MONITORING_TIMEOUT = 3000;
|
||||
static Uint32 SDL_UIKitLastPowerInfoQuery = 0;
|
||||
static Uint64 SDL_UIKitLastPowerInfoQuery = 0;
|
||||
|
||||
void SDL_UIKit_UpdateBatteryMonitoring(void)
|
||||
{
|
||||
if (SDL_UIKitLastPowerInfoQuery) {
|
||||
if (SDL_TICKS_PASSED(SDL_GetTicks(), SDL_UIKitLastPowerInfoQuery + BATTERY_MONITORING_TIMEOUT)) {
|
||||
if (SDL_GetTicks() >= (SDL_UIKitLastPowerInfoQuery + BATTERY_MONITORING_TIMEOUT)) {
|
||||
UIDevice *uidev = [UIDevice currentDevice];
|
||||
SDL_assert([uidev isBatteryMonitoringEnabled] == YES);
|
||||
[uidev setBatteryMonitoringEnabled:NO];
|
||||
|
||||
Reference in New Issue
Block a user