Modify

Opened 2 hours ago

#4044 new Bug

Time macros don't adjust to timezone changes while running script

Reported by: argumentum Owned by:
Milestone: Component: AutoIt
Version: 3.3.16.1 Severity: None
Keywords: Cc:

Description

The forum entry is at [ https://www.autoitscript.com/forum/topic/213051-autoit-error-getting-current-time/#comment-1544988 ]

A test script:

#include <Date.au3>

HotKeySet("{ESC}", "Terminate")
Func Terminate()
    Exit
EndFunc   ;==>Terminate

Exit test()
Func test()
    Local $hTimer = TimerInit(), $iSec = 88
    While 1
        Sleep(200)
        If $iSec = @SEC Then ContinueLoop
        $iSec = @SEC
        If Mod($iSec, 5) Then ContinueLoop
        ConsoleWrite('- NowCalc: ' & _NowCalc() & @TAB & @TAB & TimeZone() & @TAB & 'viaMacros: ' & _NowCalc_viaMacros() & @CRLF)
    WEnd
EndFunc   ;==>test

Func _NowCalc_viaMacros()
    Return @YEAR & '/' & @MON & '/' & @MDAY & ' ' & @HOUR & ':' & @MIN & ':' & @SEC
EndFunc   ;==>_NowCalc_viaMacros

Func TimeZone()
    Local $aInfo = _Date_Time_GetTimeZoneInformation()
    ShowTimeZoneInformation($aInfo, "")
    Return $aInfo[1] & '(' & $aInfo[7] & ')'
EndFunc   ;==>TimeZone

; Show time zone information
Func ShowTimeZoneInformation(ByRef $aInfo, $sComment)
    ConsoleWrite("+ ******************* " & $sComment & " *******************" & @CRLF)
    Local $aDaylightSavingsSetting[4] = ["Failure", "not used in the current time zone", _
            "operating with standard time", "operating with daylight savings time"]
    ConsoleWrite("+ Result ............: " & $aInfo[0] & ' = ' & $aDaylightSavingsSetting[$aInfo[0] + 1] & @CRLF)
    ConsoleWrite("+ Current bias ......: " & $aInfo[1] & @CRLF)
    ConsoleWrite("+ Standard name .....: " & $aInfo[2] & @CRLF)
    ConsoleWrite("+ Standard date/time : " & _Date_Time_SystemTimeToDateTimeStr($aInfo[3]) & @CRLF)
    ConsoleWrite("+ Standard bias......: " & $aInfo[4] & @CRLF)
    ConsoleWrite("+ Daylight name .....: " & $aInfo[5] & @CRLF)
    ConsoleWrite("+ Daylight date/time : " & _Date_Time_SystemTimeToDateTimeStr($aInfo[6]) & @CRLF)
    ConsoleWrite("+ Daylight bias......: " & $aInfo[7] & @CRLF)
EndFunc   ;==>ShowTimeZoneInformation

Attachments (0)

Change History (0)

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as new The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.