ravenfyre Posted March 13, 2004 Share Posted March 13, 2004 (edited) I'm working on a clock script and I'm almost done. The clock has to be in GMT, since my clock is PST that's an -8 hour timezone offset. Sure I can just add 8 hours to my script but I wouldn't be a very good script writer if I would lol. How can I make the script detect the timezone offset? If I can make it do that, then it can just subtract it from the @Hour macro to get the GMT. I was thinking the registry but no luck with that, found the options but not the timezone currently selected. Edited March 13, 2004 by ravenfyre Link to comment Share on other sites More sharing options...
scriptkitty Posted March 14, 2004 Share Posted March 14, 2004 reg is held I think in: My Computer\HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\TimeZoneInformation This will give you the current timezone, and if you want to cross referance with the keys in: My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones that should get you started. Or you could get a net time. AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
ravenfyre Posted March 14, 2004 Author Share Posted March 14, 2004 Hmm guess that would work but it's not really an easy fix since the key list is so long, unless I could actually search the keys My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones for the current timezone. No registry search function, guess it's time to write my own . Still before I get cracking on this, are there any other ways to get the current timezone? Link to comment Share on other sites More sharing options...
Nutster Posted March 14, 2004 Share Posted March 14, 2004 (edited) Some OS's set an environment variable TZ with the time zone information.PST8PDT The default is PST (Pacific Standard Time), which is 8 hours after GMT (If it is 12 noon in PST, it is 8 pm UCT). Daylight savings is known as PDT, which is one hour ahead.CST7 Saskatchuwan - The default is CST (Central Standard Time), which is 7 hours after GMT. There is no daylight savings time.Does that help? Edited March 14, 2004 by Nutster David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd... Link to comment Share on other sites More sharing options...
scriptkitty Posted March 14, 2004 Share Posted March 14, 2004 Sorry I thought you would figure it out, but here is the WinXp,2000,NT version: $x=RegRead ( "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\TimeZoneInformation","StandardName") $GMT=RegRead ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\"&$x,"Display") $GMT2=StringMid($gmt,5,3) msgbox(1,"Timezone="&$x, "GMT="&$GMT & @crlf & $gmt2 &" Hour adj") AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
ravenfyre Posted March 14, 2004 Author Share Posted March 14, 2004 (edited) Sorry I thought you would figure it out, but here is the WinXp,2000,NT version: $x=RegRead ( "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\TimeZoneInformation","StandardName") $GMT=RegRead ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\"&$x,"Display") $GMT2=StringMid($gmt,5,3) msgbox(1,"Timezone="&$x, "GMT="&$GMT & @crlf & $gmt2 &" Hour adj")Impressive, I would have never figured it out using this method . Never knew about stringmid, will come in handy next time I'll tinker with the registry. Thanks scriptkitty. Edited March 14, 2004 by ravenfyre 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