From 245e125e0f86f6f6ef311ed652c7766771a01c2e Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 17 Feb 2014 11:46:23 -0500 Subject: [PATCH] Corrected battery percentage on iOS (thanks, Felix!). Fixes Bugzilla #2397. --- src/power/uikit/SDL_syspower.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/power/uikit/SDL_syspower.m b/src/power/uikit/SDL_syspower.m index e7cb9c23b..393130c20 100644 --- a/src/power/uikit/SDL_syspower.m +++ b/src/power/uikit/SDL_syspower.m @@ -87,7 +87,7 @@ SDL_GetPowerInfo_UIKit(SDL_PowerState * state, int *seconds, int *percent) } const float level = [uidev batteryLevel]; - *percent = ( (level < 0.0f) ? -1 : (((int) (level + 0.5f)) * 100) ); + *percent = ( (level < 0.0f) ? -1 : ((int) ((level * 100) + 0.5f)) ); return SDL_TRUE; /* always the definitive answer on iPhoneOS. */ }