Thanks @PsaltyDS,
but function _Date_Time_SetSystemTimeAdjustment is already doing this.
; #FUNCTION# ====================================================================================================================
; Name...........: _Date_Time_SetSystemTimeAdjustment
; Description ...: Enables or disables periodic time adjustments to the system's time of day clock
; Syntax.........: _Date_Time_SetSystemTimeAdjustment($iAdjustment, $fDisabled)
; Parameters ....: $iAdjustment - The number of 100 nanosecond units added to the time of day clock at each clock interrupt if
; +periodic time adjustment is enabled.
; $fDisabled - A value of True specifies that periodic time adjustment is to be disabled. The system is free
; +to adjust time of day using its own internal mechanisms. The system's internal adjustment mechanisms may
; +cause the time-of-day clock to jump noticeably when adjustments are made. A value of False specifies that
; +periodic time adjustment is to be enabled, and will be used to adjust the time of day clock. The system will
; +not interfere with the time adjustment scheme, and will not attempt to synchronize time of day on its own.
; +The system will add the value of iAdjustment to the time of day at each clock interrupt.
; Return values .: Success - True
; Failure - False
; Author ........: Paul Campbell (PaulIA)
; Modified.......: Gary Frost (gafrost)
; Remarks .......:
; Related .......: _Date_Time_GetSystemTimeAdjustment
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _Date_Time_SetSystemTimeAdjustment($iAdjustment, $fDisabled)
; Enable system time privileged mode
Local $hToken = _Security__OpenThreadTokenEx(BitOR($TOKEN_ADJUST_PRIVILEGES, $TOKEN_QUERY))
If @error Then Return SetError(@error, @extended, False)
_Security__SetPrivilege($hToken, "SeSystemtimePrivilege", True)
Local $iError = @error
Local $iLastError = @extended
Local $iRet = False
If Not @error Then
; Set system time
Local $aResult = DllCall("kernel32.dll", "bool", "SetSystemTimeAdjustment", "dword", $iAdjustment, "bool", $fDisabled)
If @error Then
$iError = @error
$iLastError = @extended
ElseIf $aResult[0] Then
$iRet = True
Else
$iError = 1
$iLastError = _WinAPI_GetLastError()
EndIf
; Disable system time privileged mode
_Security__SetPrivilege($hToken, "SeSystemtimePrivilege", False)
If @error Then $iError = 2
EndIf
_WinAPI_CloseHandle($hToken)
Return SetError($iError, $iLastError, $iRet)
EndFunc ;==>_Date_Time_SetSystemTimeAdjustment
I think there's other reason for getting this error