Function Reference


_Date_Time_GetSystemTimeAdjustment

Determines whether the system is applying periodic time adjustments

#include <Date.au3>
_Date_Time_GetSystemTimeAdjustment ( )

Return Value

Returns an array with the following format:
[1] - The number of 100 nanosecond units added to the clock at each periodic time adjustment
[2] - The number of 100 nanosecond units between periodic time adjustments.
This interval is the time period between a system's clock interrupts.
[3] - True indicates that periodic time adjustment is disabled.
At each clock interrupt, the system merely adds the interval between clock interrupts to the clock.
If False, periodic time adjustment is being used to adjust the clock.

Related

_Date_Time_SetSystemTimeAdjustment

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