Saturday, February 13, 2010

v0.8.7, A simple time issue

So, in my last post I talked about how the interval would be saved and two potential behaviors for how the interval was going to read back into the program upon reloading. Well, what seemed to be easily implemented in theory turned out to be a rather arduous task indeed. Instead of the System.Timers.Timer object exposing a property to get the time remaining until an Elapse event occured, I had to use a complete work around by using a DateTime object instance to get the interval when it is set and determine the time it has been running if the program is stopped between the timer restarting and the Elapse event firing.

I got all the kinks worked out of this part and ran into a bit of trouble when attempting to save the value of the time left until the Elapse event to the registry.  I am saving the interval and the actual time left to elapse in milliseconds.  Well, I didn't take into account that saving these values as a DWORD type would cause the values to exceed the max value of the DWORD type.  To repair this I changed the variables from a UInt32 type to a Double type, which is capable of holding a much larger numerical value.  I then saved these values as a QWORD type in the registry.

No comments:

Post a Comment