Sign in to follow this  
Followers 0
Nahuel

System Clock Updater!

17 posts in this topic

#1 ·  Posted (edited)

-edit-

Does not work anymore. www.timeanddate.com blocked scripting. Can't be bothered to fix it.

..

Just wanted to share this with you all, since I think it turned out pretty nice <_<

Simple to use:

  • At first run, you'll need to select your location. Otherwise, you'll get argie-land's time.
  • Press "Refresh" to get the time again, although it does it every 20 seconds
  • If you want to update it, click "Update" and your computer's clock will be set with the right time
  • If the GUI is visible, it will just show you the info. If it's hidden, then it will check every 20 seconds to see if the clock is correct. If it isn't, it will automatically update it.
It supports the following cities:
Addis Ababa
Halifax
New Delhi
Adelaide
Hanoi
New Orleans
Aden
Harare
New York
Algiers
Havana
Odesa
Amman
Helsinki
Oslo
Amsterdam
Hong Kong
Ottawa
Anadyr
Honolulu
Paris
Anchorage
Houston
Perth
Ankara
Indianapolis
Philadelphia
Antananarivo
Islamabad
Phoenix
Asuncion
Istanbul
Prague
Athens
Jakarta
Reykjavik
Atlanta
Jerusalem
Rio de Janeiro
Auckland
Johannesburg
Riyadh
Baghdad
Kabul
Rome
Bangkok
Kamchatka
San Francisco
Barcelona
Karachi
San Juan
Beijing
Kathmandu
San Salvador
Beirut
Khartoum
Santiago
Belgrade
Kingston
Santo Domingo
Berlin
Kiritimati
Sao Paulo
Bogota
Kolkata
Seattle
Boston
Kuala Lumpur
Seoul
Brasilia
Kuwait City
Shanghai
Brisbane
Kyiv
Singapore
Brussels
La Paz
Sofia
Bucharest
Lagos
St. John's
Budapest
Lahore
St. Paul
Buenos Aires
Lima
Stockholm
Cairo
Lisbon
Suva
Canberra
London
Sydney
Cape Town
Los Angeles
Taipei
Caracas
Madrid
Tallinn
Casablanca
Managua
Tashkent
Chatham Island
Manila
Tegucigalpa
Chicago
Melbourne
Tehran
Copenhagen
Mexico City
Tokyo
Darwin
Miami
Toronto
Denver
Minneapolis
Vancouver
Detroit
Minsk
Vienna
Dhaka
Montevideo
Vladivostok
Dubai
Montgomery
Warsaw
Dublin
Montreal
Washington DC
Edmonton
Moscow
Winnipeg
Frankfurt
Mumbai
Yangon
Geneva
Nairobi
Zagreb
Guatemala
Nassau
Zürich

And the code:

Time_Updater.zip

Lots of thanks to Smoke_N, whose script happens to be the heart of this app.

I hope you guys like it. Any feedback/comments/critics are welcomed. :)

-edit-

Also, excuse the comments in Spanish, probable typos and unnecessary lines in the code.

Edited by Nahuel

Share this post


Link to post
Share on other sites



Very Nice job, I had to go out to www.timeanddate.com/worldclock and get my closest city location to correct my time. It changed it just looking.. LOL My fault for not looking closesly. <_< Great job on the GUI and tray menu.

Share this post


Link to post
Share on other sites

Very Nice job, I had to go out to www.timeanddate.com/worldclock and get my closest city location to correct my time. It changed it just looking.. LOL My fault for not looking closesly. <_< Great job on the GUI and tray menu.

Share this post


Link to post
Share on other sites

Thanks, I love the GUI effects too <_< But what do you mean It changed it just looking..?

Share this post


Link to post
Share on other sites

Oh, Nothing. It changed my time like you said it would. I had to get my closest city and ad it to the config for Oklahoma City for the correct time. No biggy..

Share this post


Link to post
Share on other sites

Where is EGYPT !!!!!!!!!!!! <_<

It's by city, not country. And Cairo is right there. :)

According to this map, Egypt belongs to the GMT+2 time zone.

Share this post


Link to post
Share on other sites

This is very good.

To avoid using Argentina as the default I have a function I was working on that I was going to add into my version of Date.au3. You can use any portion you need.

You probably don't even need to keep the Time zone selection if you use this. Just use GMT and the local time zone as set by the bias offset ($tzBias). Remember the offsets are in minutes from GMT so divid by 60 for hours.

Func _Date_GetTimeZoneInfo()
    $strComputer = "localhost"
    $objT_Zone = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
    $tzItems = $objT_Zone.ExecQuery("SELECT * FROM Win32_TimeZone", "WQL", 0x10 + 0x20)
    If IsObj($tzItems) then
       For $objItem In $tzItems
           With $objItem
              Global $tzBias = .Bias;; Time Zone Bias given in minutes from GMT (Use .Bias/60 to get Hours)
              Global $tzCaption = .Caption;; Time Zone Caption
              Global $tzDesc = .Description;; Time Zone Description (usually same as Caption)
              Global $setID = .SettingID;; Setting ID (not usually used)
              Global $dName = .DaylightName;; $Daylight Savings Name
              Global $dBias = .DaylightBias;; Daylight Savings Bias (in minutes)
              Global $dDay = .DaylightDay;; Daylight Savings Day
              Global $dWDay = .DaylightDayOfWeek;; Daylight Savings Day of Week
              Global $dYear = .DaylightYear;; Daylight Savings Year
              Global $dMon = .DaylightMonth;; Daylight Savings Month
              Global $dHour = .DaylightHour;; Daylight Savings Hours
              Global $dMin = .DaylightMinute;; Daylight Savings Minutes
              Global $dSec = .DaylightSecond;; Daylight Savings Seconds
              Global $dMsec = .DaylightMillisecond;; DayLight Milliseconds
              Global $sName = .StandardName;; Standard Time Name
              Global $sBias = .StandardBias;; Standard Time Bias (in minutes)
              Global $sDay = .StandardDay;; Standard Time Day
              Global $sWDay = .StandardDayOfWeek;; Standard Time Day Of Week
              Global $sYear = .StandardYear;; Standard Time Year
              Global $sMon = .StandardMonth;; Standard Time Month
              Global $sHour = .StandardHour;; Standard Time Hours
              Global $sMin = .StandardMinute;; Standard Time Minutes
              Global $sSec = .StandardSecond;; Standard Time Seconds
              Global $sMsec = .StandardMillisecond;; Standard Time Milliseconds
          EndWith
#cs; For display only         
          $Output=""
       $Output &= "Computer: " & $strComputer  & @CRLF
          $Output &= "==========================================" & @CRLF
          $Output &= "Bias: " & $tzBias & " minutes from GMT" & @CRLF & "Caption: " & $tzCaption & @CRLF
          $Output &= "Description: " & $tzDesc & @CRLF & "SettingID: " & $setID & @CRLF & @CRLF
       $Output &= "Daylight Name: " & $dName & @CRLF & "Daylight Bias: " & $dBias & @CRLF & "Daylight Day: " & $dDay & @CRLF
          $Output &= "Daylight Day of Week: " & $dWDay & @CRLF & "Daylight Year: " & $dYear & @CRLF & "Daylight Month: " & $dMon & @CRLF
          $Output &= "Daylight Hour: " & $dHour & @CRLF & "Daylight Minute: " & $dMin & @CRLF & "Daylight Second: " & $dSec & @CRLF
          $Output &= "Daylight Millisecond: " & $dMsec & @CRLF & @CRLF
          $Output &= "Standard Name: " & $sName & @CRLF & "Standard Bias: " & $sBias & @CRLF & "Standard Day: " & $sDay & @CRLF
          $Output &= "Standard Day Of Week: " & $sWDay & @CRLF & "Standard Year: " & $sYear & @CRLF & "Standard Month: " & $sMon & @CRLF
          $Output &= "Standard Hour: " & $sHour & @CRLF & "Standard Minute: " & $sMin & @CRLF
          $Output &= "Standard Second: " & $sSec & @CRLF & "Standard Millisecond: " & $sMsec & @CRLF
          $Output &= "=========================================="
          If Msgbox(1,"Time Zone Info",$Output) = 2 then ExitLoop
          $Output=""
#ce
        Next
    Endif
EndFunc   ;<===> _Date_GetTimeZoneInfo()

HTH


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Wow, that's a kickass function. I'd love to use it in my script, but I don't really know how... Your function returns lots of information and it seems to me that the only thing I could use is the 'Time Zone Bias given in minutes from GMT', but then I'd have to know what's the time zone for each city? Is there an easier way?

Share this post


Link to post
Share on other sites

As I pointed out that function was work in progress.

The Month and day settings shown are for setting DST start stop dates.

Set $nZone to 211 which is the only city in your list which is on GMT all year.

Calculate the local time using $tzBias

I also changed you Warning Msg to "the program will use: & @CRLF & $tzCaption & @CRLF"

Also played with your main msg loop a bit.

While 1

$sTime = _NowTime()

If GUICtrlRead($HoraPC) <> $sTime Then GUICtrlSetData($HoraPC, $sTime)

Rest of your loop

WEnd


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Is there something wrong with Windows builtin time synchronization?

Share this post


Link to post
Share on other sites

While 1
$sTime = _NowTime()
If GUICtrlRead($HoraPC) <> $sTime Then GUICtrlSetData($HoraPC, $sTime)

Rest of your loop
WEnd
That's good, but I didn't want that because I wanted both the PC time and the one from the website to be refreshed at the same time. But it doesn't really make a big difference. :)

I'll play with your function and I'll see what I can do, thank you :P

@weaponx: <_< I don't have that... my other computer does but it never worked. Besides, this one can be running all the time checking if your clock is correct every now and then...

Share this post


Link to post
Share on other sites

Then why not GUICtrlSetData($HoraPC, _NowTime()) ahead of the loop so the script starts with the current sysem time?


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Sure, why not. As I said, it wouldn't make a big difference <_< What I wanted to do is refresh them both at the same time so the time from the PC and the website are obtained and displayed at the same time, making a bit more accurate.

Share this post


Link to post
Share on other sites

It will still do that. It just makes it look a bit better if there is something displayed as soon as the app fires up, especially if the app is run before a net connecion is established.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
<_< yeah.. that's true :) I'll do it.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0