introduction to timekeeping
TRANSCRIPT
A Brief Introduction to Timekeeping
Steven Kreuzer
NYCBUGJuly 2014
What is Time?• It is pretty tricky to define in a way that is not
circular
• Simply a matter of counting cycles or units of time
What is a Clock?• A clock consists of an oscillator and a counter
• The function of the oscillator is to establish a repeatable interval of time
• By counting those intervals it is possible to create a time scale
Greenwich Mean Time
• Mainly used by astronomers so it was based on measurements of true earth rotation
• Rise of railroads caused the need for accurate, uniform time leading to the creation of time zones and standard time
• Between 1848 to 1972, all of the major countries adopted time zones based on GMT
Time Zones• 24 time zones, each differing from the next
by 1 hour and span 15 degrees of longitude
• Local time is determined by government so they usually follow the countries borders
• From time to time a country will opt to change their time zone for various reasons
Coordinated Universal Time
• Earth rotation varies over time so a time scale based on this will vary over time
• UTC is based on Atomic Time (TAI) which is a time scale where the length of a second does not vary
Leap Second• To keep UTC consistent with the actual earth
rotation speed, leap seconds are inserted
• Leap seconds can be inserted and removed, but so far they have only been inserted
• 26 leap seconds have been inserted since 1972
• The last second was inserted on June 30th 2015
Evolution of The Clock
• Late 1630 - Galileo observed that a pendulum took the same time to swing through a wide arc as a narrow arc
• Mid 1650 - Christiaan Huygens introduces the pendulum clock
• Mid 1720 - John Harrison improved the accuracy of the pendulum clock to 1/5 second per day
• Early 1920 - William Hamilton Shortt introduces the two-pendulum clock and squeezed the last ounce of perfection out of mechanical clocks.
The Quartz Crystal• Piezoelectricity first demonstrated by Pierre
and Jacques Curie in 1880
• When piezoelectric material is subjected to mechanical stress, it creates an electrical charge
• Inverse is also true
• Typical drift of a quartz watch is ~1 second per day
Quartz Stability• Temperature influences the operating
frequency
• Frequency will slow down when the temperature either increases or decreases
Improving Quartz Stability
• Analog compensation (TCXO)
• Microcontroller compensation (MCXO)
• Temperature stabilization w/ a crystal oven (OCXO)
Atomic Clocks• Changes in the energy levels of atoms
release electromagnetic radiation of very specific frequencies
• Atoms don’t wear out, change their properties over time or have small differences due to manufacturing imprecisions
• Accuracy better than 1 second in six million years
Global Positioning System
• Cesium 133 atomic clocks on-board each satellite
• Radio signals broadcast from satellites include the exact time the signal was transmitted
• Offers a direct and accurate connection to UTC
Disciplining a Clock• Provide a reference time source which is
more accurate and set the system time in periodic intervals
• This method allows system time to drift during each interval
• Ideal solution is to determine the system clock drift to discipline the system time smoothly
Network Time Protocol
• RFC 5905 - Network Time Protocol Version 4: Protocol and Algorithms Specification
• RFC 5906 - Network Time Protocol Version 4: Autokey Specification
• RFC 5907 - Definitions of Managed Objects for Network Time Protocol Version 4
• RFC 5908 - Network Time Protocol Server Option for DHCPv6
Basic Features of NTP
• Enable clients across the Internet to be accurately synchronized to UTC
• Provide most accurate time possible, based on ‘reference time’ - not just syncing to a common time
• Ignore ‘falsetickers’ - clocks it could use for reference, but which provide an apparently wrong time
• Use previous figures to estimate current difference between system time and reference time, in the absence of a network connection
Synchronization Hierarchy
• Clients query the reference time from one or more servers
• Servers make its own time available as reference time for other clients
• Peers compare its system time to other peers until all the peers finally agree about the"true" time to synchronize to
Stratum Levels• Stratum 0 - Reference Clock Source (gps,
cdma)
• Stratum 1 - Primary Time Servers
• Stratum 2 - Secondary Time Servers
• Stratum 3 - Workstations
Order of Operations• The client stamps the time when it sends an
NTP packet to the server
• The server stamps the time when it receives the packet from the client
• The server stamps the time when it sends a packet back to the client
• The client stamps the time when the NTP reply packet is received
Synchronization Problems
• Two clocks hardly ever agree
• Clocks tick at different rates
• Skew is the difference between two clocks at one point in time
Defining Skew and Jitter
• Clock skew is the deterministic difference in clock arrival times
• Clock jitter is random difference in clock arrival times
• Jitter is always bad
Dealing with Drift• If the clock is running fast, make the clock
run slower until it synchronizes
• If the clock is running slow, make the clock run faster until it synchronizes
• The clock must always be moving forward. The illusion of time moving backwards causes all sorts of problems
Time Synchronization• Allows events to occur at proper times
• Provide proof of when events occurred or did not occur
Conclusion• Accurate time is a necessity of modern
society
• Synchronized time is a integral part of an effective network
• Ensuring accurate time is inexpensive but offers a significant return on investment
–John Wheeler
“Time Is What Prevents Everything From Happening At Once..”