GNOME Bugzilla – Bug 706318
rounding error in stopwatch
Last modified: 2013-08-24 11:44:25 UTC
elapsed time and lap time doesn't always agree, for instance in [1] we can see that according to lap#18 time and elapsed time at lap#17 we should have elapsed time 01:40:11 instead of 01:40:12 This problem is not due to the rounding policy, indeed if we have lap#n elapsed time: 5.146, lap time: 3.362 lap#(n+1) elapsed time: 9.304, lap time: 4.158 we're going to have problems using both ceil or floor. [1] https://www.dropbox.com/s/rojplhcvamvtwmh/Screenshot%20from%202013-08-19%2013%3A45%3A09.png
Created attachment 252256 [details] [review] tentative patch
(In reply to comment #1) > Created an attachment (id=252256) [details] [review] > tentative patch tentative patch, saving the time information with four integers let us round one time only. By the way I believe that the code I added in utils.vala could be an example of how not to write code :) Maybe we could use two arrays for the time information, for instance: minuend[h] instead of m_h minuend[m]] instead of m_m subtrahend[c] instead of s_s and so on... I mean I really don't like the code I wrote, I would be happy to ear some hints to make it more neat
I fixed this in a simpler way in https://git.gnome.org/browse/gnome-clocks/commit/?id=b5059d963c1f1d3fd4ef3c612eedaa8ea540a752 Please double check my naive approach is not buggy :)
I really like your solution :)