Link to home
Start Free TrialLog in
Avatar of fifo123
fifo123

asked on

Synchronizing system time

Hey guys,
I'm not sure if this is the right forum for this question.
I have a time server that I want a number of windows XP machines to synchronize with.  How can I configure them so that they try to synchronize at 3:00 am.  I don't want to set intervals as in "run every x number of hours".  I want them to sync at a specific time.  Is this possible?  Could this be done programmatically?

Thanks
Avatar of _TAD_
_TAD_



The best method would probably be to create a window's service on your "time machine"
 he he

This service would do three things:

1) Poll the time once every second (or two depending on how accurate you want to be).
2) At 2 AM, gather a list of all servers on the network (either by IP or by alias)
3) at 3 AM, log into each server and set the time to 3AM



As a control point, I would create a global flag isRunning which is set to false most of the time.  Then when the application is gathering data or updating servers then the flag will be set to true (so we don't duplicate processes).

I would probably also put the 3AM update into a seperate thread for each server.  So at 3AM your CPU on your time machine will jump to 60% or 80% (and network traffic will spike), but then at least then all computers will be updated at the same time.


Your other alternative (which we use at my job) is to have each computer at a scheduled time check the time server and then update its own time with whatever the time machine has.

We do this because of reboot and backup schedules.  if all of the machines were going to be updated at the same time, then we could not perform backups or reboots at 3AM.



Avatar of fifo123

ASKER

Hey TAD,
Thanks for the response.
In the implementation used at your job, how do you guys schedule each computer to check the time server at a specific time?  Do you have a custom application that does this?  If so, do you know of a sample I can take a look at anywhere?

I have been trying to edit the registry entry at:
HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ W32Time \ TimeProviders \ NtpClient \

but I don't see anything that would allow me to set a schedule time.  It only allows intervals.

thanks for your help.


For servers that we re-boot on a weekly basis, we re-sync at boot up.  So we are not sync-ing at "3 AM", we are instead going out to the time server and grabing the current time and then setting the machine clock to that time.   This happens on a periodic rate for servers that stay on all the time (like domain servers), or else happens at reboot for production application servers.


As for code... I really think it is a simple DOS batch program that is executed at startup or is scheduled to execute by the Win NT/2000 scheduler.
ASKER CERTIFIED SOLUTION
Avatar of _TAD_
_TAD_

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial