AutoHotkey Community

It is currently May 26th, 2012, 11:09 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 53 posts ]  Go to page Previous  1, 2, 3, 4
Author Message
 Post subject:
PostPosted: April 9th, 2008, 10:52 pm 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
mhe wrote:
how does it know what timezone to use and so forth?


System clock runs as UTC.
The file downloaded has UTC time.
The clock time in tray is derived by OS by using registry settings.

mhe wrote:
Does it handle DST aswell?


It should.. I cannot test.

:)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 9th, 2008, 11:02 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
mhe wrote:
how does it know what timezone to use and so forth? Does it handle DST aswell?
MSDN wrote:
SetSystemTime Function:
Sets the current system time and date. The system time is expressed in Coordinated Universal Time (UTC).
It means, Windows uses the system time zone settings, converts the UTC time to local.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Easy Way
PostPosted: October 29th, 2008, 6:28 pm 
Offline

Joined: February 7th, 2005, 11:11 am
Posts: 192
Location: Munich, Germany
What's about this:
Code:
runwait, net time /setsntp:"de.pool.ntp.org",,hide
run, w32tm /resync,,hide

That's optimized for Germany. You can find your server by visiting http://www.pool.ntp.org/zone/@ and chose your location (zone/country).

Or am I completely wrong? :shock: :oops:

_________________
Peter

Wisenheiming for beginners: KaPeGe (German only, sorry)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 29th, 2008, 7:11 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
I just got the message (w/o hide) that "The computer did not resync because no time data was available."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 29th, 2008, 7:49 pm 
Offline

Joined: February 7th, 2005, 11:11 am
Posts: 192
Location: Munich, Germany
Laszlo wrote:
I just got the message (w/o hide) that "The computer did not resync because no time data was available."

Mhm. You're from Pittsburg...
What's abbout that:
Code:
runwait, net time /setsntp:"us.pool.ntp.org",,hide
run, w32tm /resync,,hide

_________________
Peter

Wisenheiming for beginners: KaPeGe (German only, sorry)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 29th, 2008, 8:47 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
the same


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 4th, 2009, 4:14 am 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
My Latest / Shortest code:

SetAtomicTime() returns a True on successful Time Synch or False otherwise.

Code:
SetAtomicTime( Server="http://207.200.81.113:13" ) {
 UrlDownLoadToFile, %Server%, % A_Temp "\Time.0"
 FileRead, X, % A_Temp "\Time." (Err:=ErrorLevel)
 X := (Err ? "" : "20") . SubStr( X,8,24 ), VarSetCapacity( T,18,0 )
 Loop, Parse, X, - :
  NumPut( A_LoopField, T, ((O:=2*(A_Index-1))>2 ? O+2 : O), "Short" )
 Return (!Err and !NumGet(T,16,"Short")) ? !!DllCall( "SetSystemTime",Str,T ) : 0
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 14th, 2010, 2:26 am 
Offline

Joined: April 30th, 2006, 6:23 pm
Posts: 358
Location: Shigle Springs
SKAN wrote:
My Latest / Shortest code:

SetAtomicTime() returns a True on successful Time Synch or False otherwise.

Code:
SetAtomicTime( Server="http://207.200.81.113:13" ) {
 UrlDownLoadToFile, %Server%, % A_Temp "\Time.0"
 FileRead, X, % A_Temp "\Time." (Err:=ErrorLevel)
 X := (Err ? "" : "20") . SubStr( X,8,24 ), VarSetCapacity( T,18,0 )
 Loop, Parse, X, - :
  NumPut( A_LoopField, T, ((O:=2*(A_Index-1))>2 ? O+2 : O), "Short" )
 Return (!Err and !NumGet(T,16,"Short")) ? !!DllCall( "SetSystemTime",Str,T ) : 0
}


Sweeeeeeeeeeeeeeeeeeeeeeeet! Thank you.
I have a few thousand people using my CPULOCK and your code is a part of it now..
:D :wink: I added a little extra stuff to your code.
Code:



SetAtomicTime()


SetAtomicTime( Server="http://207.200.81.113:13" ) {

ifnotexist, c:\temp ; I may be wrong, but I think I had some trouble with A_Temp because some of my clients had their paths all messed up by a virus.
FileCreateDir, c:\temp
dir = c:\temp
FileDelete, % dir "\Time.0"
UrlDownLoadToFile, %Server%, % dir "\Time.0"
If (ErrorLevel) {
  UrlDownLoadToFile, http://192.43.244.18:13, % dir "\Time.0"
If (ErrorLevel) {
  UrlDownLoadToFile, http://69.25.96.13:13, % dir "\Time.0"
If (ErrorLevel) {
  UrlDownLoadToFile, http://64.236.96.53:13, % dir "\Time.0"
If (ErrorLevel) {
  UrlDownLoadToFile, http://68.216.79.113:13, % dir "\Time.0"
If (ErrorLevel) {
  UrlDownLoadToFile, http://129.6.15.29:13, % dir "\Time.0"
If (ErrorLevel) {
  UrlDownLoadToFile, http://129.6.15.28:13, % dir "\Time.0"
If (ErrorLevel) {
  UrlDownLoadToFile, http://132.163.4.103:13, % dir "\Time.0"
If (ErrorLevel) {
  UrlDownLoadToFile, http://132.163.4.102:13, % dir "\Time.0"
If (ErrorLevel) {
  UrlDownLoadToFile, http://132.163.4.101:13, % dir "\Time.0"
}
}
}
}
}
}
}
}
}

 FileRead, X, % dir "\Time." (Err:=ErrorLevel)
 FileDelete, % dir "\Time.0"
 X := (Err ? "" : "20") . SubStr( X,8,24 ), VarSetCapacity( T,18,0 )
 Loop, Parse, X, - :
  NumPut( A_LoopField, T, ((O:=2*(A_Index-1))>2 ? O+2 : O), "Short" )
 Return (!Err and !NumGet(T,16,"Short")) ? !!DllCall( "SetSystemTime",Str,T ) : 0
 
}

Its ugly but it adds many servers if one is down. :oops:
I went through all the IP addresses I fond here and these are the ones that are still working.

_________________
CPULOCK.com
virusSWAT.com
Computer Repair Computer Service.com
911PCFIX.com


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 53 posts ]  Go to page Previous  1, 2, 3, 4

All times are UTC [ DST ]


Who is online

Users browsing this forum: Exabot [Bot] and 8 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group