Information générale
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
>>>Set the interval to 10000 and the timer event will fire every 10 seconds.
>>>
>>>>This sound inaccurate. Seems like it could wander using this method. That's why I figured if every 10 seconds I could look and see if my machine time (atomic time) was 05:59 I would play the wav. Your method leaves me at the mercy of the internal clock tick correct?
>>
>>So how do I keep it from firing every 10 seconds during 05:59 till 06:00?
>
>You don't. It fires, checks the current system time against the next event time, and if the time is up (i.e. current system time equal or greater than event time), it fires the event, and sets this.nextEventTime to the time of the next event.
>
>Suppose it fires at 5:59:04. It sees that the current event is supposed to happen no earlier than 5:59:00, so it fires the event (i.e. plays the sound, makes coffee, whatever you tell it to do), and then it looks up the next event - it's scheduled for 6:00:00.
>Next time it fires at 5:59:14, sees it's not 6:00:00 yet, and does nothing.
>Next time it fires at 5:59:24, sees it's not 6:00:00 yet, and does nothing.
>...
>Next time it fires at 6:00:04, sees it's past 6:00:00 now, and launches the 6:00 event, looks up the next event etc etc.
Thank you all! This message finally made it sink in. Our factory buzzer died due to a roof leak and this will get the buzzer in sync with our data collection clocks. Our 150 employees will be very happy!
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement