Added remaining driving time to Driver Timer

My latest commits to my dissertation project added a countdown timer to show the user how much driving time they have remaining.

This took me a while to show remaining time correctly. The Driver Timer counts up in seconds, I then use modulo operation (http://en.wikipedia.org/wiki/Modulo_operation) in order to display this counter correctly for time, for example, when the seconds reach 60, they should then return to 0 and not 61. I originally displayed the maximum amount for each driving time, 4 hours, 30 minutes and 0 seconds and then removed the current driving time from it. While this does work initially, testing revealed that it would beging to show negative numbers after a 30 minutes and seconds would need to start at 60 on the remaining timer, which did not look intuitive. The technique I finally used was to do something similar, earlier on in the code. After working out how many seconds were in 4 and a half hours, I was able to subtract the current amount of seconds from that and then apply a modulo operator in the same way as the driving time to display the remaining time correctly.

https://github.com/sephallen/DriverTimer/commit/84f2a4ff623af617504d79acfe001cfc57e6dcde

download (3)

November 10, 2014