introduction to timekeeping

25
A Brief Introduction to Timekeeping Steven Kreuzer [email protected] NYCBUG July 2014

Upload: steven-kreuzer

Post on 15-Apr-2017

111 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Introduction to Timekeeping

A Brief Introduction to Timekeeping

Steven Kreuzer

[email protected]

NYCBUGJuly 2014

Page 2: Introduction to Timekeeping

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

Page 3: Introduction to Timekeeping

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

Page 4: Introduction to Timekeeping

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

Page 5: Introduction to Timekeeping

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

Page 6: Introduction to Timekeeping

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

Page 7: Introduction to Timekeeping

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

Page 8: Introduction to Timekeeping

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.

Page 9: Introduction to Timekeeping

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

Page 10: Introduction to Timekeeping

Quartz Stability• Temperature influences the operating

frequency

• Frequency will slow down when the temperature either increases or decreases

Page 11: Introduction to Timekeeping

Improving Quartz Stability

• Analog compensation (TCXO)

• Microcontroller compensation (MCXO)

• Temperature stabilization w/ a crystal oven (OCXO)

Page 12: Introduction to Timekeeping

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

Page 13: Introduction to Timekeeping

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

Page 14: Introduction to Timekeeping

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

Page 15: Introduction to Timekeeping

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

Page 16: Introduction to Timekeeping

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

Page 17: Introduction to Timekeeping

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

Page 18: Introduction to Timekeeping

Stratum Levels• Stratum 0 - Reference Clock Source (gps,

cdma)

• Stratum 1 - Primary Time Servers

• Stratum 2 - Secondary Time Servers

• Stratum 3 - Workstations

Page 19: Introduction to Timekeeping

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

Page 20: Introduction to Timekeeping

Synchronization Problems

• Two clocks hardly ever agree

• Clocks tick at different rates

• Skew is the difference between two clocks at one point in time

Page 21: Introduction to Timekeeping

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

Page 22: Introduction to Timekeeping

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

Page 23: Introduction to Timekeeping

Time Synchronization• Allows events to occur at proper times

• Provide proof of when events occurred or did not occur

Page 24: Introduction to Timekeeping

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

Page 25: Introduction to Timekeeping

–John Wheeler

“Time Is What Prevents Everything From Happening At Once..”