# Clock drift

Clock drift

Clock drift refers to several related phenomena where a clock does not run at the exact right speed compared to another clock. That is, after some time the clock "drifts apart" from the other clock. This phenomenon is also used for instance in computers to build random number generators. On the negative side, clock drift can be exploited by timing attacks.

## Clock drift in normal clocks

Normal clocks such as clocks at home and wristwatches usually drift compared to the actual time. This is why it is necessary to reset them occasionally. Clocks often drift differently depending on their quality, the exact power they get from the battery, the surrounding temperature and other environmental variables. Thus the same clock can have different clock drift rates at different occasions.

Mechanical watches drift much more than quartz ones, but they are designed to drift ahead rather than behind[citation needed], so that the watch gains time, making it easier to set the time to the second with the hack (stop mechanism) function.

More advanced clocks and old mechanical clocks often have some kind of speed trimmer where one can adjust the speed of the clock and thus reduce the clock drift. For instance, in pendulum clocks the clock drift can be manipulated by slightly changing the length of the pendulum. The formula of Fast drift is dc/dt>1.

## Atomic clocks

Atomic clocks are very precise and have nearly no clock drift. The rotation of the Earth itself actually has much more clock drift (less accuracy) than modern atomic clocks. Thus to keep the Coordinated Universal Time (UTC) in line with the Earth's rotation, a leap second is added to some years.

## Relativity

As Einstein predicted, relativistic effects can also cause clock drift due to time dilation[citation needed]. This is because there is no fixed universal time, time being relative to the observer. Special relativity describes how two clocks held by people in different inertial frames (i.e. moving with respect to each other but not accelerating or decelerating) will each appear to tick more slowly to the other person.

In addition to this, general relativity gives us gravitational time dilation. Briefly, a clock in a higher gravitational field (e.g. closer to a planet) will appear to tick more slowly. People holding these clocks would agree on which clock appeared to be going faster.

Note that it is time itself rather than the function of the clock which is affected. Both effects have been experimentally observed.

Time dilation is of practical importance. For instance, the clocks in GPS satellites experience this effect due to the reduced gravity they experience (making their clocks appear to run more quickly than those on Earth) and must therefore incorporate relativistically corrected calculations when reporting locations to users. If general relativity were not accounted for, a navigational fix based on the GPS satellites would be false after only 2 minutes, and errors in global positions would continue to accumulate at a rate of about 10 kilometers each day.[1]

## Random number generators

Computer programs often need high quality random numbers, especially for cryptography. There are several similar ways clock drift can be used to build random number generators (RNGs).

One way to build a hardware random number generator is to use two independent clock crystals, one that for instance ticks 100 times per second and one that ticks 1 million times per second. On average the faster crystal will then tick 10,000 times for each time the slower one ticks. But since clock crystals are not precise, the exact number of ticks will vary. That variation can be used to create random bits. For instance, if the number of fast ticks is even, a 0 is chosen, and if the number of ticks is odd, a 1 is chosen. Thus such a 100/1000000 RNG circuit can produce 100 somewhat random bits per second. Typically such a system is biased—it might for instance produce more zeros than ones—and so hundreds of somewhat random bits are "whitened" to produce a few unbiased bits.

There is also a similar way to build a kind of "software random number generator". This involves comparing the timer tick of the operating system (the tick that usually is 100–1000 times per second) and the speed of the CPU. If the OS timer and the CPU run on two independent clock crystals the situation is ideal and more or less the same as the previous example. But even if they both use the same clock crystal the process/program that does the clock drift measurement is "disturbed" by many more or less unpredictable events in the CPU such as interrupts and other processes and programs that runs at the same time. Thus the measurement will still produce fairly good random numbers. Some argue[who?] they are then not true random numbers but they seem to be good enough for most needs.[citation needed]

Note that most hardware random number generators such as the ones described above are fairly slow. Therefore most programs only use them to create a good seed that they then feed to a pseudorandom number generator or a cryptographically secure pseudorandom number generator to produce many random numbers fast.

## Timing attack

In 2006, a side channel attack was published[2] that exploited clock skew based on CPU heating. The attacker causes heavy CPU load on a pseudonymous server, causing CPU heating. CPU heating is correlated with clock skew, which can be detected by observing timestamps (under the server's real identity).

## References

1. ^ Pogge, Richard W.; “Real-World Relativity: The GPS Navigation System” Accessed 4 January 2010.
2. ^ Steven J. Murdoch. Hot or Not: Revealing Hidden Services by their Clock Skew, ACM CCS 2006. (pdf)

Wikimedia Foundation. 2010.

### Look at other dictionaries:

• Drift — may mean: Contents 1 Film and literature 2 Geography 3 Industry …   Wikipedia

• Clock synchronization — is a problem from computer science and engineering which deals with the idea that internal clocks of several computers may differ. Even when initially set accurately, real clocks will differ after some amount of time due to clock drift, caused by …   Wikipedia

• Drift (telecommunication) — In telecommunication, a drift is a comparatively long term change in an attribute, value, or operational parameter of a system or equipment. The drift should be characterized, such as diurnal frequency drift and output level drift. Drift is… …   Wikipedia

• Clock skew — Contents 1 In circuit design 1.1 Harmful skew 1.2 Beneficial skew 2 On a network 3 Interfaces …   Wikipedia

• Clock shear — is a term in electronic circuit design that refers to the accumulation of the signal integrity factors that pertain to the validity of differential signaling, particularly differential clocks. There are several important parameters of electronic… …   Wikipedia

• Clock recovery — Some digital data streams, especially high speed serial data streams (such as the raw stream of data from the magnetic head of a disk drive) are sent without an accompanying clock signal. The receiver generates a clock from an approximate… …   Wikipedia

• Clock code — The clock code is a method of mentally computing the sine of an angle between zero and sixty degrees. Pilots sometimes need to do this to estimate the heading correction due to the wind, and sailors may find it useful to do the same thing to… …   Wikipedia

• MIDI beat clock — is a clock signal that is broadcast via MIDI to ensure that several synthesizers stay in synchronization. It is not MIDI timecode.Unlike MIDI timecode, MIDI beat clock is sent at a rate that represents the current tempo. It is used to maintain a… …   Wikipedia

• Rorke's Drift — Infobox Military Conflict conflict=Battle of Rorke s Drift partof=the Anglo Zulu War caption= date=22 January ndash; 23 January 1879 place=Rorke s Drift, South Africa result=British victory combatant1= combatant2=Zulu Kingdom commander1=John… …   Wikipedia

• Molecular clock — Part of a series on Evolutionary Biology …   Wikipedia