Another thing: might be better to declare the number of seconds in an hour as a constant rather than having it be repeatedly calculated all the time. Minor thing. I think the compiler would optimise it anyway.