[Gambas-user] Best method to trigger event at midnight?
Benoît Minisini
gambas at ...1...
Sat Mar 23 20:06:42 CET 2013
Le 23/03/2013 19:43, dr.diesel a écrit :
> I'm looking to trigger an event at midnight, any suggestions on the best
> method to ensure the time is not missed?
>
> My application reads/writes a DB, launches websites and reads heavily on the
> COM port. I'm afraid that if I simply look for the date/time to be 00:00
> I'll miss the time while some other event is happening. Do I need to just
> carefully code this or is there some other method I'm not seeing?
>
> Many thanks
> Andy
>
Check the time with two timers.
For example, the first timer will be raised for example each hour. And
when it is past 23:00, start another timer with a more precise
resolution to check when midnight is reached.
You can use more timers. It depends on which precision you need.
But beware that there is only one thread in Gambas, so a too long event
handler prevents other events to be raised.
Regards,
--
Benoît Minisini
More information about the User
mailing list