While computers manage many things with extreme precision, they have surprising difficulty keeping track of time.
It's pretty much impossible for a computer to keep exact time, although accuracy can be improved to the extent that users are willing to spend more money on the problem, said George Neville-Neil, who spoke at the Association for Computing Machinery's Applicative conference in New York last week.
"There are so many variables in trying to get time better or close to right," he said.
Neville-Neil is a software engineer who helps financial institutions and other time-sensitive organizations maintain ultra-precise measurements of time. He works on the Precision Time Protocol (PTP), an IEEE standard for relaying the time over a network with greater accuracy than the industry standard Network Time Protocol (NTP).
A computer clock can be thrown off by many factors, including network jitter, delays introduced by software, and even the environmental conditions in which the computer is operating.
To keep internal time, computers use a crystal oscillator that creates an electromagnetic signal, or a vibration that the computer uses to coordinate processor, memory, bus and motherboard operations.
But computer makers often use inexpensive crystals costing only a few cents each, which can compromise accuracy. "If you buy server-class hardware, you will get cheap crystal, and time will wander if you don't do something about it," Neville-Neil said.
As crystals age, their frequencies drift. The workload on a system can also affect a crystal's output: the more work a system does, the hotter it gets, and the heat causes the crystal vibrations to increase in frequency.
The average crystal ends up being about as accurate as a mechanical watch, meaning both can skew faster or slower over time at about the same rate. You're shiny new iPhone has about the same time accuracy as a good mechanical watch built decades ago, according to Neville-Neil.
He tested his own laptop against an expensive precision clock and found his computer had drifted off by 15 milliseconds within two hours. "This is typical behavior," he said.
Most end-users wouldn't notice such small discrepancies, but increasingly some computer systems require high precision.
Distributed systems, which harness multiple servers to work on a single task, require the computers be synchronized on the same time. Debugging distributed systems requires understanding an temporal order of events as they unfurl across different nodes.
Robotic systems also require precise time, to calibrate motions of their moving parts. Power companies use time to control the frequency of the alternating current delivered to customers; U.S. power grids need time to be counted out 60 times a second, for instance.
Sign up for Computerworld eNewsletters.