Guest User

Untitled

a guest
Jun 18th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. Protected Overrides Sub OnStart(ByVal args() As String)
  2. ' Add code here to start your service. This method should set things
  3. ' in motion so your service can do its work.
  4. Dim oCallBack As New TimerCallback(AddressOf TimedEvent)
  5. oTimer = New System.Threading.Timer(oCallBack, Nothing, 300000, 300000)
  6. EventLog.WriteEntry("CCFinalizeService has begun successfully." , _
  7. System.Diagnostics.EventLogEntryType.Information)
  8.  
  9. End Sub
  10.  
  11. Dim now As Date = DateTime.Now
  12. Dim dueTime As Integer ' milliseconds to the next half-hour
  13. dueTime = 1800000 - (now.Minute Mod 30) * 60000 - now.Second * 1000 - now.Millisecond
  14. oTimer = New System.Threading.Timer(oCallBack, Nothing, dueTime, 1800000)
  15.  
  16. If Now.Minute <> 0 Or Now.Minute <> 30 Then
  17. Thread.Sleep((30 - Now.Minute) * 60 * 1000)
  18. End If
Add Comment
Please, Sign In to add comment