Summary: | green progress circle doesn't accurate work for >= 1h | ||
---|---|---|---|
Product: | [Applications] kteatime | Reporter: | Frederik Schwarzer <schwarzer> |
Component: | general | Assignee: | 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
*** Bug 217202 has been marked as a duplicate of this bug. *** 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. Created attachment 57773 [details]
Proposed patch to solve the problem
Different drawPie arguments
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). Created attachment 58137 [details]
KTeaTime integer overflow fix
Fixes integer overflow by casting m_runningTeaTime indirectly to long by multiplying it by 360L * 16L.
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? *** This bug has been marked as a duplicate of bug 275598 *** |