Bug 217201

Summary: green progress circle doesn't accurate work for >= 1h
Product: [Applications] kteatime Reporter: Frederik Schwarzer <schwarzer>
Component: generalAssignee: Stefan Böhmann <kde>
Status: RESOLVED DUPLICATE    
Severity: normal CC: kde, xdunlapx
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Unspecified   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Proposed patch to solve the problem
KTeaTime integer overflow fix

Description Frederik Schwarzer 2009-12-03 14:36:28 UTC
Version:            (using KDE 4.3.2)
Installed from:    Debian testing/unstable Packages

The green progress circle doesn't show the right proportions if you set up 2 hours anonymously.
Comment 1 FiNeX 2009-12-03 18:57:20 UTC
*** Bug 217202 has been marked as a duplicate of this bug. ***
Comment 2 Brittany Dunlap 2011-02-18 00:58:43 UTC
The problem is with exactly 1 hour or above. It is inaccurate. For example if set for one hour, at 30 minutes it shows approximately 15 minutes left on the circle indicator.
Comment 3 Roman Fietze 2011-03-08 13:44:07 UTC
Created attachment 57773 [details]
Proposed patch to solve the problem

Different drawPie arguments
Comment 4 Roman Fietze 2011-03-09 13:47:15 UTC
The statement

p.drawPie( rectangle, 90*16, -(360 * 16 * m_runningTeaTime) / m_runningTea.time() );

is not yet completely correct, because with larger values we run into overflows.

The correct statement has to be

p.drawPie( rectangle, 90*16, -(360L * 16L * m_runningTeaTime) / m_runningTea.time() );

Because openSUSE currently updates to 4.6.1 in the Release repos, I cannot test it using kteatime directly. But a small test program shows proper results going down (or better up) from -5758 (-359 degrees) to 0 for all selected times up to several hours (I think it's 27 hours on a 32 bit system, even more on a 64 bit system).
Comment 5 Roman Fietze 2011-03-18 10:32:55 UTC
Created attachment 58137 [details]
KTeaTime integer overflow fix

Fixes integer overflow by casting m_runningTeaTime indirectly to long by multiplying it by 360L * 16L.
Comment 6 Roman Fietze 2012-11-07 07:52:39 UTC
The bug seems to be fixed for quite some time now. Tested with different KDE versions since 4.5.

Could please somebody verify this and evt. set it to RESOLVED?
Comment 7 Christoph Feck 2013-10-29 23:57:38 UTC

*** This bug has been marked as a duplicate of bug 275598 ***