From abcc5051f6360381e8123c8410605efaa59fe978 Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Wed, 21 Jan 2015 14:06:40 +0000 Subject: [PATCH] Bug 1124127 - round power percentage to whole number before passing on, r=gsvelto --HG-- extra : rebase_source : 69c55368a10c076e9726db9894f2d355326d9aad --- hal/linux/UPowerClient.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hal/linux/UPowerClient.cpp b/hal/linux/UPowerClient.cpp index 66dd97351e1e..3b769099d953 100644 --- a/hal/linux/UPowerClient.cpp +++ b/hal/linux/UPowerClient.cpp @@ -9,6 +9,7 @@ #include #include #include "nsAutoRef.h" +#include /* * Helper that manages the destruction of glib objects as soon as they leave @@ -428,14 +429,14 @@ UPowerClient::UpdateSavedInfo(GHashTable* aHashTable) } /* - * The battery level might be very close to 100% (like 99.xxxx%) without + * The battery level might be very close to 100% (like 99%) without * increasing. It seems that upower sets the battery state as 'full' in that * case so we should trust it and not even try to get the value. */ if (isFull) { mLevel = 1.0; } else { - mLevel = g_value_get_double(static_cast(g_hash_table_lookup(aHashTable, "Percentage")))*0.01; + mLevel = round(g_value_get_double(static_cast(g_hash_table_lookup(aHashTable, "Percentage"))))*0.01; } if (isFull) {