LoWang Posted September 15, 2011 Share Posted September 15, 2011 Today I noticed very strange thing on some of our computers. The system time is 14:00 but the @hour macro in compiled script is populated with 12! WTH?? Time Zone: (GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague I found two pcs with this problem so far, while another one where it is OK - the script shows the same time as the system clock - does not seem to have any different settings Time Zone: (GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague not only @hour but also _nowcalc() shows the time 2 hours backwards! Please advice. This really causes big problems for me. Link to comment Share on other sites More sharing options...
Tankbuster Posted September 15, 2011 Share Posted September 15, 2011 (edited) Is the script run in a different user profile (like a service?) Than maybe the profile shows a different regional settings. I had some code left from a previous problem to display the bias. You may want to try the code to display the current settings, of course not as a fix/help but maybe just as a helping hand. (do not look to close on the calculation line...more like a hint) So if the line is somehow correct, you may need to start your date string not by using @hour @min and so on but from a UTC string. #include <GuiConstantsEx.au3> #include <Date.au3> #include <WindowsConstants.au3> #include <array.au3> $tCur = _Date_Time_GetSystemTime() $tCurStr=_Date_Time_SystemTimeToDateTimeStr($tCur) $aTimeZone = _Date_Time_GetTimeZoneInformation () ;~ _ArrayDisplay($aTimeZone) ConsoleWrite("TimeZone:"&$aTimeZone[5]&@CRLF) ConsoleWrite("Dayligh settings:"&$aTimeZone[0]&@CRLF) ConsoleWrite("Current bias for this computer:"&$aTimeZone[1]&@CRLF) ConsoleWrite("Current bias for this timezone:"&$aTimeZone[7]&@CRLF) ConsoleWrite("@Hours is:"&@hour&@CRLF) ConsoleWrite("UTC time:"&$tCurStr&@CRLF) ConsoleWrite("localtime should be: UTCtime = localtime + bias pc + bias timezone"&@CRLF) ConsoleWrite("localtime should be: "&$tCurStr&" = "&_now()&"h + "&$aTimeZone[1]&"min + "&$aTimeZone[7]&"min"&@CRLF) Edited September 15, 2011 by Tankbuster Link to comment Share on other sites More sharing options...
LoWang Posted September 16, 2011 Author Share Posted September 16, 2011 and on the other pc where it is OK it looks like this: Link to comment Share on other sites More sharing options...
Juvigy Posted September 16, 2011 Share Posted September 16, 2011 (edited) Make a simple script in the PC with the BUG. Something like: #include <Date.au3> MsgBox(0,"",_NowCalc()) Run it on the bug PC and tell us what are the results. @edit Copy mistake corrected Edited September 16, 2011 by Juvigy Link to comment Share on other sites More sharing options...
Tankbuster Posted September 16, 2011 Share Posted September 16, 2011 as a result of my script you see that the frist PC (wrong one) it reports that UTC time is LOCALtime. while the other PC2 (correct one) got a bias of 2h from UTC time. Now this explains why @hour is wrong on PC1, but it does not explain the root cause. Let me think about this.........maybe some where in the registry.... (btw: both run on XP/32? In user space) Link to comment Share on other sites More sharing options...
water Posted September 16, 2011 Share Posted September 16, 2011 #include <Word.au3> MsgBox(0,"",_NowCalc())Shouldn't it be "#include <date.au3>" My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
LoWang Posted September 16, 2011 Author Share Posted September 16, 2011 (edited) #Include <Date.au3> $p=_Date_Time_GetTimeZoneInformation() $d=_NowCalc() msgbox(0,"time","hour:"&@HOUR&" time different from UTC:"&$p[1]&" DST bias:"&$p[7]&" _nowcalc():"&$d) Bugged PC:OK PC: Both computers are Windows XP 32bit SP3 Edited September 16, 2011 by LoWang Link to comment Share on other sites More sharing options...
Tankbuster Posted September 16, 2011 Share Posted September 16, 2011 (edited) Something I would like to know: Could you please check on BOTH PC the Time displayed in the BIOS? Maybe the HW-Clock is not correct and so windows tries to display something corrected? Edited September 16, 2011 by Tankbuster Link to comment Share on other sites More sharing options...
LoWang Posted September 16, 2011 Author Share Posted September 16, 2011 (edited) the bugged computer shows 10:50 in the BIOS which is proper time for our timezone (UTC + 1 + DST) I will now check the OK computer the OK computer shows the same time in BIOS: 10:54 by now Edited September 16, 2011 by LoWang Link to comment Share on other sites More sharing options...
Tankbuster Posted September 16, 2011 Share Posted September 16, 2011 Ah, than it's easier...it's only a matter of windows.....no, this was a joke. If you check eg the eventlog of the PC1 does it also display wrong entries? Or are there other logs (from other apps) to have the same behavior. I do not believe it's a matter of autoit. BTW: if you do a "echo %TIME%" on a cmd does it show also the wrong time? Link to comment Share on other sites More sharing options...
LoWang Posted September 16, 2011 Author Share Posted September 16, 2011 (edited) I found more pcs on our network with this problem and more pcs which are OK. This is crazy echo %TIME% shows time correctly YES the other applications which make logfiles have it 2 hours back also on the bugged pc! But windows event viewer shows correct time. Only the text log files from apps shows it 2 hours back. Edited September 16, 2011 by LoWang Link to comment Share on other sites More sharing options...
bogQ Posted September 16, 2011 Share Posted September 16, 2011 (edited) try this post #10 to see if it have any diffrance Edited September 16, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
Tankbuster Posted September 16, 2011 Share Posted September 16, 2011 "network" - are you also connected to a domain (controller)? If so, what's his time/timezone? Link to comment Share on other sites More sharing options...
LoWang Posted September 16, 2011 Author Share Posted September 16, 2011 OK PC: C:\>cas2 _WinAPI_GetLocalTime(): 16/9/2011 12:20:50 _WinAPI_GetSystemTime(): 16/9/2011 10:20:50 @HOUR: 12 Bugged pc: C:\>cas2 _WinAPI_GetLocalTime(): 16/9/2011 12:22:14 _WinAPI_GetSystemTime(): 16/9/2011 10:22:14 @HOUR: 10 And yes those pcs are connected to a domain controller but they have set internet time NTP server to europe.pool.ntp.org, so I am not sure if domain controller talks to it yet or not... Link to comment Share on other sites More sharing options...
bogQ Posted September 16, 2011 Share Posted September 16, 2011 (edited) so now you know that you can use _WinAPI_GetLocalTime(): so that your time can b pulled correcty as for @HOUR, i dont have slitest idea what can b wrong, but can you tellme one thing, your using XP sp3 on them correct? what version of XP are you using(home? pro? unstandard XP verison?)? did you instal some time addons on that mashines? Edited September 16, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
LoWang Posted September 16, 2011 Author Share Posted September 16, 2011 (edited) Hm that is really cool that I can just recompile all my scripts to use _WinAPI_GetLocalTime() because @hour is broken from some mysterious reason! :-\ And it is not just my scripts! Also our company software which makes logfiles is affected by this and writes timestamps 2 hours backwards. These computers have the same image of Windows XP Professional and I did not fiddle with any time addons or whatever you mean... I will try to reimage the one bugged pc if it changes Edited September 16, 2011 by LoWang Link to comment Share on other sites More sharing options...
LoWang Posted September 16, 2011 Author Share Posted September 16, 2011 (edited) reimage of the computer fixed the problem. I am now looking how many more computers with this problem I will find on our network... Interestingly I found only 5 more pcs with this problem out of about 700 total :-] Edited September 16, 2011 by LoWang Link to comment Share on other sites More sharing options...
Juvigy Posted September 16, 2011 Share Posted September 16, 2011 Very strange issue - did you try changing the zone ? I remember there was some issue with the Daylight saving check on XP. MS issued a fix that may be the issue here. Link to comment Share on other sites More sharing options...
bogQ Posted September 16, 2011 Share Posted September 16, 2011 (edited) I did not fiddle with any time addons or whatever you mean... I will try to reimage the one bugged pc if it changes i mean something like timezone addon http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=25166 or something similar that can messup something newer the less i think that you shud recompile with _WinAPI_GetLocalTime only 2 b shure that something like that if it happend in the future will not influence your scripts any more. and + you can add something like this so that you can get neare the problem if it ever happen $time = _WinAPI_GetLocalTime() if $time[X] <> @HOUR then MsgBox(0,'Your time probably isnt displaying correctly','Pls report this msg to your administrator') Edited September 16, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
LoWang Posted September 23, 2011 Author Share Posted September 23, 2011 (edited) sh*t It's screwed up again. That pc I fixed by reinstallation started to do it again this morning! I give up and will recompile my scripts with this crazy Win API :-\ I hope it will not be taking too much CPU if processed often. But this is no solution for the other software running on such a machine which is confused too by this...Like symantec antivirus for example. Edited September 23, 2011 by LoWang Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now