vendredi 10 avril 2015

VB - Set a timer to a windows service every half an hour

I was able to build a windows service using a timer that executes a function every 30 minutes.


I want that this function to be executed every half an hour, for example. 00:00, 00:30, 01:00.


It can do that now but I have to start the service for example at 14:00 so it follows this pattern (each 30 minutes).


I want to automate this so if I start the service 14:08 it will still execute at 14:30 and not 14:38.


Extra information: This is the function I use for the timer



oTimer = New Timer()
oTimer.Interval = 900000
AddHandler oTimer.Elapsed, AddressOf OnTimer

Aucun commentaire:

Enregistrer un commentaire