Countdown timer continuously running
11 visualizzazioni (ultimi 30 giorni)
I am trying to figure out the best approach to this so I appreciate your thoughts. I'm running a model that uses the number of minutes remaining as an input. Let's say it counts down to September 30th. So as of right now there is roughly 21*24*60 = 30,240 minutes remaining. The time remaining should decrease every second. How can I achieve this? Some sort of endless loop? Part of a script? Or a function? Keep in mind this is only one input in my model, and there are many other moving parts. What type do I want...a datetime array? That is what I have been working with so far.
Tim Jackman il 14 Set 2015
I'd recommend using a timer object. You can set it to execute a callback function every second. Within that callback function, you can update your countdown variable. It seems like the thing to try first in your scenario. Here are a couple links that include a basic example on how timer objects work:
As for your question about what data type to use, a datetime array should be fine. Alternatively, you could convert the datetime into the number of minutes or seconds remaining if that is all you need from this variable. Hope this helps.