bartekd Posted May 16, 2009 Share Posted May 16, 2009 I am trying to make a gui with a couple digital clocks in it, that each have a different time zone. I looked on the forum, and all I see is complicated gui pretty analog clocks. Is there a basic way to display the current time in another time zone? If someone could point me to the right direction of one clock with time zone support, I will expand it to have a couple clocks which each have their own time zone. it would be better to have the seconds refresh realtime (while loop). Link to comment Share on other sites More sharing options...
Zedna Posted May 16, 2009 Share Posted May 16, 2009 Start with GetTimeZoneInformation API functionhttp://msdn.microsoft.com/en-us/library/ms724421(VS.85).aspxThere are also other time API functions out therehttp://msdn.microsoft.com/en-us/library/ms725473(VS.85).aspxYou may look at my Radar project (in my signature) where I used GetTimeZoneInformation API function to recognize summer/winter (daylight) time. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
bartekd Posted May 16, 2009 Author Share Posted May 16, 2009 Thanks Zedna. I haven't dove into API's yet, not that I am new to Autoit, but don't have a deep knowledge of programming. I decided to go simple. #include <GUIConstants.au3> $Form = GUICreate("TimeZone GUI", 116, 183, 193, 125) $BCLabel = GUICtrlCreateLabel("BC: " , 10, 16, 45, 17) $BC = GUICtrlCreateLabel(@HOUR-3 & ":" & @MIN & ":" & @SEC , 44, 16, 45, 17) $ONTLabel = GUICtrlCreateLabel("ONT: " , 10, 46, 45, 17) $ONT = GUICtrlCreateLabel(@HOUR & ":" & @MIN & ":" & @SEC , 44, 46, 45, 17) GUISetState(@SW_SHOW) While 1 GUICtrlSetData($BC,@HOUR-3 & ":" & @MIN & ":" & @SEC ) GUICtrlSetData($ONT,@HOUR & ":" & @MIN & ":" & @SEC ) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
trancexx Posted May 16, 2009 Share Posted May 16, 2009 Thanks Zedna. I haven't dove into API's yet, not that I am new to Autoit, but don't have a deep knowledge of programming. I decided to go simple. #include <GUIConstants.au3> $Form = GUICreate("TimeZone GUI", 116, 183, 193, 125) $BCLabel = GUICtrlCreateLabel("BC: " , 10, 16, 45, 17) $BC = GUICtrlCreateLabel(@HOUR-3 & ":" & @MIN & ":" & @SEC , 44, 16, 45, 17) $ONTLabel = GUICtrlCreateLabel("ONT: " , 10, 46, 45, 17) $ONT = GUICtrlCreateLabel(@HOUR & ":" & @MIN & ":" & @SEC , 44, 46, 45, 17) GUISetState(@SW_SHOW) While 1 GUICtrlSetData($BC,@HOUR-3 & ":" & @MIN & ":" & @SEC ) GUICtrlSetData($ONT,@HOUR & ":" & @MIN & ":" & @SEC ) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEndThat is flickering. Try this: #include <GUIConstants.au3> Global $Form = GUICreate("TimeZone GUI", 116, 183, 193, 125) Global $BCLabel = GUICtrlCreateLabel("BC: ", 10, 16, 45, 17) Global $BC = GUICtrlCreateLabel("", 44, 16, 45, 17) Global $ONTLabel = GUICtrlCreateLabel("ONT: ", 10, 46, 45, 17) Global $ONT = GUICtrlCreateLabel("", 44, 46, 45, 17) Global $iHour, $iMin, $iSec, $iSecNew GUISetState(@SW_SHOW) While 1 $iSecNew = @SEC If $iSecNew <> $iSec Then $iHour = @HOUR $iMin = @MIN GUICtrlSetData($BC, $iHour - 3 & ":" & $iMin & ":" & $iSecNew) GUICtrlSetData($ONT, $iHour & ":" & $iMin & ":" & $iSecNew) $iSec = $iSecNew EndIf Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
bartekd Posted May 17, 2009 Author Share Posted May 17, 2009 That is flickering. Try this: #include <GUIConstants.au3> Global $Form = GUICreate("TimeZone GUI", 116, 183, 193, 125) Global $BCLabel = GUICtrlCreateLabel("BC: ", 10, 16, 45, 17) Global $BC = GUICtrlCreateLabel("", 44, 16, 45, 17) Global $ONTLabel = GUICtrlCreateLabel("ONT: ", 10, 46, 45, 17) Global $ONT = GUICtrlCreateLabel("", 44, 46, 45, 17) Global $iHour, $iMin, $iSec, $iSecNew GUISetState(@SW_SHOW) While 1 $iSecNew = @SEC If $iSecNew <> $iSec Then $iHour = @HOUR $iMin = @MIN GUICtrlSetData($BC, $iHour - 3 & ":" & $iMin & ":" & $iSecNew) GUICtrlSetData($ONT, $iHour & ":" & $iMin & ":" & $iSecNew) $iSec = $iSecNew EndIf Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Great, that works good. Thanks 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