Attached is a timer form. It's accurate because it's using system time, not a straight "countdown" method as I had tried originally. I tested it against my digital wrist watch using 10 minutes (600 seconds) and it matched exactly. Test it and see what you think. If you prefer, you can change the variable's display setting to show no decimal places - but the form's OnTimer setting is set to 0.1 seconds as is the code. Don't change those settings otherwise it may not be accurate. The countdown changes color at the 10 second & 5 second marks and the buzzer sounds at zero.
There is also a timer_x form that just does a time display at 0, 0.0 and 0.00 places and a simple countdown - click the start button to countdown intelligibly. I just built it to prove the point that you can have accurate OnTimer event at 0.01 - but it depends upon how much junk code you add. Form UI methods can trip up a fast form counter since the screen draws may take longer that the count cycle, so the next cycle is already executing before the last one has finished (or barely started). It really depends upon what you are trying to get away with.
Technically the timer might still work ok if you set the form's OnTimer event to 0.01 seconds - but if the variable's display is set to 2 decimal places the display it will "jump" over certain values in the 0.nn range. That's probably because the eye can't keep up with that rate of change or it may be because the OnTimer event does not correspond exactly to the value it is set to. But that doesn't effect the accuracy of the clock for the reasons described above.
In short, my recommendation is to leave the variable display to 1 decimal place or no decimals.
Note: I'm not an xdialog fan hence the form method. But no offense to you xdialog savants.
Timer.zip
There is also a timer_x form that just does a time display at 0, 0.0 and 0.00 places and a simple countdown - click the start button to countdown intelligibly. I just built it to prove the point that you can have accurate OnTimer event at 0.01 - but it depends upon how much junk code you add. Form UI methods can trip up a fast form counter since the screen draws may take longer that the count cycle, so the next cycle is already executing before the last one has finished (or barely started). It really depends upon what you are trying to get away with.
Technically the timer might still work ok if you set the form's OnTimer event to 0.01 seconds - but if the variable's display is set to 2 decimal places the display it will "jump" over certain values in the 0.nn range. That's probably because the eye can't keep up with that rate of change or it may be because the OnTimer event does not correspond exactly to the value it is set to. But that doesn't effect the accuracy of the clock for the reasons described above.
In short, my recommendation is to leave the variable display to 1 decimal place or no decimals.
Note: I'm not an xdialog fan hence the form method. But no offense to you xdialog savants.
Timer.zip
Comment