GoodTimeCount Program
piguy101
Posts: 248
I just got the Propeller Education Kit on Christmas (great gift, by the way) and I think the GoodTimeCount program on page 66 in the manual is over complicated. The program just keeps track of the real time in seconds and uses modulus operator to determine when minutes, hours, and days have passed. Below the program, it says that the program will fail when seconds = 2^31 - 1 because the seconds will reset to -2^31 + 1. Instead of using modulus, could the program wait for seconds to get to 60 and reset the seconds? This way the program could run for 2^31 -1 years. I know this is kind of pointless because of the low crystal accuracy, but would this work? Please keep in mind I've only had the Propeller for a few days. Thank you for your time.
Comments
I think the idea of not resetting the seconds is that you can easily build the difference of two points in time. For example an event occurred today and the next event can occur 20 days later. By not resetting the seconds since startup you only have to record this value and you can calculate days only ... or days and hours ....