Does anyone know how to access what time remains before the next OnTimer event occurs?
I know I can calculate it from when the event timer is set. But is there another way? I did not see anything in the documentation.
That is what I did. I use the timer event it to update some external parameters and write some files. I display the time remaining, mostly because I am curious. I started with an input variable:
input int Opti_Sec=4; // hours between parameter check
I declared a global variables:
datetime lastontimer; // last ontime event
The I set it to the local time in the OnInit and Ontimer functions:
And when I wanted to display it, I just use the local time to calculate the time remaining:
string cmt="Time to Next Update: "+TimeToString((Opti_Sec*60*60)-(TimeLocal()-lastontimer),TIME_SECONDS)+"\n";