Bug 382069

Summary: Time remaining shows 0:60 (0 hours, 60 minutes) > expecting 1:00 (1 hour, 0 minutes)
Product: [Plasma] plasmashell Reporter: wutr <wutr>
Component: Power and Battery widgetAssignee: Kai Uwe Broulik <kde>
Status: RESOLVED FIXED    
Severity: normal CC: plasma-bugs
Priority: NOR    
Version First Reported In: 5.10.3   
Target Milestone: 1.0   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Screenshot of battery endurance remaining showing 0 hours 60 minutes (0:60)

Description wutr 2017-07-06 17:41:22 UTC
Created attachment 106468 [details]
Screenshot of battery endurance remaining showing 0 hours 60 minutes (0:60)

Difficult for me to duplicate as it of course depends on the current charge and load / expected load of the system. However it should be fixable in the source as there is clearly a problem with the conversion from minutes into hours.

Screenshot attached
Comment 1 David Edmundson 2017-07-07 11:46:22 UTC
Git commit 13675d6ab695ba3d1e621ae5493f66ee25e5091d by David Edmundson.
Committed on 06/07/2017 at 20:16.
Pushed by davidedmundson into branch 'master'.

Fix display of formatDuration with rounding.

Summary:
When showing the time (1 hour 59.5 minutes) with seconds hidden we
want to show "2 hours 0 minutes" not "1 hour 60 minutes".

This is fixed by performing the rounding before we split the number of
miliseconds into component parts, rather than splitting and then
rounding.
Related: bug 360681

Test Plan: Updated unit test

Subscribers: #frameworks

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D6537

M  +20   -0    autotests/kformattest.cpp
M  +14   -8    src/lib/util/kformatprivate.cpp

https://commits.kde.org/kcoreaddons/13675d6ab695ba3d1e621ae5493f66ee25e5091d