Jump to content

Recommended Posts

Posted

I have a problem when getting the time to process (with @HOUR @MIN @SEC macros)

when changing the time zone, the system time also changes

but the macro time is not updated according to the system time.

Is this a serious bug of autoit?

Regards,
 

Posted (edited)

just curious. Does _NowCalc() behave as it should compared to the @macros ?

Edit: Yes, only the macros are wrong.

Spoiler
#include <Date.au3>

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

Exit test()
Func test()
    ; change TimeZones while running this script
    ConsoleWriteIt()
    AdlibRegister(ConsoleWriteIt, 5000) ; ConsoleWriteIt every 5 sec.
    While Sleep(200)
    WEnd
EndFunc   ;==>test

Func ConsoleWriteIt()
    ConsoleWrite((_NowCalc() = _NowCalc_viaMacros() ? '-' : '!') & ' NowCalc: ' & _NowCalc() & _
            @TAB & TimeZone() & @TAB & 'viaMacros: ' & _NowCalc_viaMacros() & @CRLF)
EndFunc   ;==>ConsoleWriteIt

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

Func TimeZone()
    Local $aInfo = _Date_Time_GetTimeZoneInformation()
    If @error Then Dim $aInfo[8] = [-2]
;~  ShowTimeZoneInformation($aInfo, "")
    Return StringRight('    ' & $aInfo[1] & '(' & $aInfo[7] & ')', 11)
EndFunc   ;==>TimeZone

; Show time zone information
Func ShowTimeZoneInformation(ByRef $aInfo, $sComment)
    ConsoleWrite("+ ******************* " & $sComment & " *******************" & @CRLF)
    Local $aDaylightSavingsSetting[5] = ["Error", "Failure", "not used in the current time zone", _
            "operating with standard time", "operating with daylight savings time"]
    ConsoleWrite("+ Result ............: " & $aInfo[0] & ' = ' & $aDaylightSavingsSetting[$aInfo[0] + 2] & @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

 

 

 

Edited by argumentum
better

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...