''' <summary>
''' Sets the computers local time
''' </summary>
''' <param name="TimeToSet">The time to set the computers clock to</param>
Public Sub SetComputerTime(ByVal TimeToSet As Date)
Dim systime As SYSTEMTIME = New SYSTEMTIME
systime.Day = TimeToSet.Day
systime.Year = TimeToSet.Year
systime.Month = TimeToSet.Month
systime.DayOfWeek = TimeToSet.DayOfWeek
systime.Hour = TimeToSet.Hour
systime.Second = TimeToSet.Second
systime.Minute = TimeToSet.Minute
systime.Milliseconds = TimeToSet.Millisecond
SetLocalTime(systime)
End Sub
Declare Function SetLocalTime Lib "kernel32.dll" (ByRef time As SYSTEMTIME) As Boolean
Structure SYSTEMTIME
<Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.U2)> Public Year As Short
<Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.U2)> Public Month As Short
<Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.U2)> Public DayOfWeek As Short
<Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.U2)> Public Day As Short
<Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.U2)> Public Hour As Short
<Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.U2)> Public Minute As Short
<Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.U2)> Public Second As Short
<Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.U2)> Public Milliseconds As Short
End Structure