Function Reference


_Date_Time_SetSystemTimeAdjustment

Enables or disables periodic time adjustments to the system's time of day clock

#include <Date.au3>
_Date_Time_SetSystemTimeAdjustment ( $iAdjustment, $bDisabled )

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.
$bDisabled 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 Value

Success: True
Failure: False

Related

_Date_Time_GetSystemTimeAdjustment

Example

#include <Date.au3>
#include <MsgBoxConstants.au3>
#include <WinAPI.au3>

; Under Vista the Windows API "SetSystemTimeAdjustment" may be rejected due to system security

Example()

Func Example()
    Local $aInfo

    ; Open the clock so we can watch the fun
    Run("RunDll32.exe shell32.dll,Control_RunDLL timedate.cpl")
    WinWaitActive("[CLASS:#32770]")

    ; Get current time adjustments
    $aInfo = _Date_Time_GetSystemTimeAdjustment()

    ; Slow down clock
    If Not _Date_Time_SetSystemTimeAdjustment($aInfo[1] / 10, False) Then
        MsgBox($MB_SYSTEMMODAL, "Error", "System clock cannot be DOWN" & @CRLF & @CRLF & _WinAPI_GetLastErrorMessage())
        Exit
    EndIf
    MsgBox($MB_SYSTEMMODAL, "Information", "Slowing down system clock", 2)

    Sleep(5000)

    ; Speed up clock
    If Not _Date_Time_SetSystemTimeAdjustment($aInfo[1] * 10, False) Then
        MsgBox($MB_SYSTEMMODAL, "Error", "System clock cannot be UP" & @CRLF & @CRLF & _WinAPI_GetLastErrorMessage())
    EndIf
    MsgBox($MB_SYSTEMMODAL, "Information", "Speeding up system clock", 2)

    Sleep(5000)

    ; Reset time adjustment
    If Not _Date_Time_SetSystemTimeAdjustment($aInfo[1], True) Then
        MsgBox($MB_SYSTEMMODAL, "Error", "System clock cannot be RESET" & @CRLF & @CRLF & _WinAPI_GetLastErrorMessage())
    Else
        MsgBox($MB_SYSTEMMODAL, "Information", "System clock restored")
    EndIf
EndFunc   ;==>Example