Drift in PC Clock


Thread Starter

Vipul Shah

I have a critical data logging application that logs process data with timestamp cyclically. However there is a drift in the PC Clock over a period of time due to which the time stamps are not accurate and the data logged becomes inaccurate relative to another system. How can I prevent this clock drift as the 2 systems go out of time syncronization. How do I prevent this drift? Are there any cards available for this purpose?

Thanks in Advance.
Vipul Shah
I find that using the "nettime" ( see Dos Help for how to use it ) command in DOS is useful. I assume the two machines that you are wanting to synch are on the same network ? If so, then this can be used by making a small batch file that is called by Microsoft Task Scheduler every 24 hours or so.

Failing that, there are PC cards that pick up time transmissions ( over here in the UK it is the Rugby time transmission ).

Hope this helps.
Use a time server program on one of the PC and a time client program on the other. The client will send a request to the server and the server will then respond with the current time of the server PC. Note that this time might not be accurate in regard to the rest of the world.

For more accurate timing in regard to the rest of the world, the time server can be any of the time servers available on the internet.

You can do a search on yahoo, etc for time synchronizing softwares.
You can download free of the internet applications that will synchronize your PC clock with time.gov, a US government site that has the current time, you specify the offset from GMT. The sync. is usually better than .7 seconds. You set the program up to run at a specific time every day and it will update the PC clock automatically.

Ranjan Acharya

Whenever I do any control system I try to make one system the master clock. Then, all PLCs and so on are synchronised to that system.

Modicon's Quantum, for example, has a card with a GPS receiver that lets you synchronise to GPS time (not quite atomic time, no leap seconds, but close enough).

You can get the same type of stuff for standalone PCs - clock receivers (e.g., if you are in the US or Canada then there are radio signals you can
lock in to, or go for GPS again).

If you are crazy and do not mind networking your control system to all the hackers on the Internet then you can get any old clock synchronisation


If they are on a LAN, look up ntp (network time protocol).

If they're not on a LAN, look up ntp anyway, because the documentation mentions hardware solutions, albeit higher-end ones (more accurate).

The other way is to rig a `full hour' or `midnight' tick in your process, synch to that, and ignore what the real time is.

Jiri Baum <[email protected]> http://www.csse.monash.edu.au/~jirib
MAT LinuxPLC project --- http://mat.sf.net --- Machine Automation Tools

Prabhat Ranjan

It is possible to synchronise clock of computer using Network Time Protocol (NTP). One computer can be made time server and other client. This is a software solution, but possibly solve your problem. I am sure there are software packages available on internet for Windows. I am only aware of Linux packages.
Hope it helps,

- Prabhat Ranjan

Prof. Prabhat Ranjan,
Dhirubhai Ambani Institute for Information
and Communication Technology (DA-IICT),
Gandhinagar - 382009 (Gujarat) - India
Web Page : http://www.da-iict.org
Phone : (079) 3265553 (Direct) (079) 3243800 (PBX)
Fax : 91-79-3243588
To clarify, the command is "net time", i.e. the "time" sub command of the "net" command. To get full DOS help issue the command "net help time". The computer providing time needs to be running the NTP server which is part of the "Simple TCP/IP Services" OS option. A computer that is a NTP server will have a UDP "*:*" on port 123 when "netstat -a" is ran from the a DOS command line.
I see cheap accurate radio timebases on the horizon. I can buy a wall clock now for $29.95 that syncs to the national standard broadcasts. In 5 years or so that should trickle down to automation and shouldn't be more than $1500.00. I surprised no one had taken the simple expedient of using the power line frequency to correct for drift. It's not atomic accuracy, but it would be good enough for most purposes. Another thing
on my gadget list.



Walters Curt L

I am using the Microsoft time synchronizer called TIMESERV. You simply load it on each machine and specifiy one machine as the time source. All
machines will at intervals that you specify automatically update their time from the source machine. The source machine can be synchronized to one of many external time sources, if you like. You can add an IRIG card or synch via phone line to a national standard. TIMESERV comes with the NT resource kit. I think it works with Windows2000 also. Another time synchronizer is W32Time, which I have not tried. It replaces
TIMESERV in applications that do not use an external source.

With respect to the power line freq synchronization, It may be me, but when the Venezuelan Government (the place where I live) reduced this freq (I was told so, in order to save energy?), my electric clocks started to drift... Am I crazy or these devices are using the 60Hz freq signal?

How the freq reduction could help to save energy??
Most power systems do have a master clock and a system clock for control of integrated frequency so that clocks using synchronous motors maintain correct time for years. Some loads are frequency dependent so dropping frequency is one way to
reduce total load and it is fairly commonly done during peak periods. The loss in time is compensated in the off peak periods by running a little above nominal frequency to return the system clock to the master clock time.


Bob Peterson

In the US the power line frequency is very accurate over time. It drifts a little, but is corrected so that clocks using it as a timebase (either digitally or via a synchronous motor) tend to be accurate.
The command "net time \\computername" looks useful but it only returns a precision of a minute. I need to know the difference to a tenth of a second. Any suggestions?


Bruce Durdle

In New Zealand, the electrical supply system is small enough that reasonably common changes in load or supply capacity will cause significant
frequency fluctuations - like from 50 Hz to 47.5 or even lower in extreme events. (At one stage the capacity in the North Island was about 30 GW,
with the largest power station a 1000 MW thermal one - when it fell off, the loss of capacity was significant).

Anyway, one of the criteria for the System Control engineers was to ensure that the accumulated error over a 24 hour period was less than about 5 seconds - this was done with one clock running off the mains compared to another regulated with a precision pendulum setup. One machine or station on the system was dedicated to keeping the frequency correct, and governed
purely on speed using an integral algorithm to keep things on track (the rest being effectively proportionally controlled from speed/power).

So yes any accumulated drift in the mains frequency will affect the time displayed on clocks driven by synchronous motors.

These changes in frequency also have some interesting effects on older UPS equipment using ferro-resonant transformers, but that's another story.


Diana C Bouchard

So far as I know, ALL electric clocks use the power line frequency. I have heard that many years ago, when parts of Ontario, Canada converted
from 25 to 60 Hz, power company representatives came round to people's houses, collected all their electrical appliances, modified them to run on 60 Hz, and returned them to their owners (this was obviously before home computers and would probably be infeasible now). But they just replaced electric clocks because their operation was directly dependent on the frequency.

Diana Bouchard
Pulp and Paper Research Institute of Canada (Paprican)
Pointe Claire, Quebec, Canada
[email protected]
If accuracy of time is critical in your application, the best way is to plug-in a GPS-PCI card into the PCI slot of your machine. Then use this machine as the NTP server and synchronize all other machines in thye network by loading NTP client software.

The accuracy you get will be in the order 1 millisecond. And there would be no drift since the local clock is disciplined with GPS signal.

Ravi Kiran