l12 - Time and Synchronization v22
l12 - Time and Synchronization v22
l12 - Time and Synchronization v22
Bekkeng, 30.12.2021
Why is time and synchronization so
important?
• Some examples:
– Accurate time stamping of scientific data
– In financial trading we must know the time accurately.
– Important to reduce confusion in shared file systems.
– Update databases (in parallel).
– Tracking security breaches or network usage requires accurate
timestamps in logs.
– Used in electric power systems (fault recorders, billing meters,
etc.).
– Necessary in telecommunication networks.
– Global Navigation Satellite Systems (GNSS), such as GPS,
requires very accurate clock synchronization for position
calculations.
• PNT is important in
many applications!
• Hardware clocks
– Real Time Clock (RTC) is an integrated circuit on the motherboard.
– The RTC has a battery backup power so that it tracks the time even
while the computer is turned off.
– Based on a 32.768 kHz quartz crystal oscillator.
– Maximum resolution of 1 millisecond (1 kHz).
• Software clocks
– Maintained by the operating system, based on the RTC interrupts.
– When the system starts it sets the system time to a value based on the
real-time clock of the computer and then regularly updates the time
based on interrupts from the RTC.
Computer clock drift
• The software clock is a bad timekeeper (without corrections)!
• The computer clock drifts away from the correct time. At the time of
synchronization with a time server the clock is reset to the “correct
time” (but with a small offset).
• Could update the computer clock often (using NTP or PTP), or
read time directly from a timing card connected to a GPS
antenna, IRIG-B signal or an IEEE1588 signals.
Access the TSC (or HPET) timer using the Windows API functions
QueryPerformanceCounter (μs resolution) and QueryPerformanceFrequency
QueryPerformanceCounter(n) − QueryPerformanceCounter(n − 1)
∆𝑇 =
QueryPerformanceFrequency
Using HPET or TSC ? Not documented …
LabVIEW
Extra
QueryPerformance from LabVIEW
TSC example
TAI and UTC time
• UTC is the time standard used for many internet and World
Wide Web standards. The Network Time Protocol (NTP),
designed to synchronize the clocks of computers over the
Internet, encodes times using the UTC system.
Leap seconds
• Time is now measured using stable atomic clocks
.
Since 1967, the second has been defined to be the duration of 9,192,631,770
periods of the radiation corresponding to the transition between the two hyperfine
levels of the ground state of the cesium 133 atom
GPS time
• GPS time is the atomic time scale implemented by the atomic clocks
in the GPS ground control stations and the GPS satellites themselves.
• Periodic corrections are performed to the on-board satellite clocks to
keep them synchronized with ground station clocks.
• GPS time is NOT corrected for leap seconds.
• GPS time is NOT equal to UTC or TAI time.
– GPS time is 18 seconds ahead of UTC because of the leap
seconds added to UTC.
– A new leap second correction will be added to UTC in 2021
– GPS time was set to match UTC in 1980
• However, the time offset from UTC is contained in the GPS
broadcast message and is usually applied automatically by GPS
receivers.
From: http://leapsecond.com/java/gpsclock.htm
A GPS satellite clock run faster
(about 38 μs a day) due to
velocity and gravity effects
(follows the Relativity theory)
Time dilation
Time stamping of data
• We often need to timestamp an image in a video stream or a
block of data from a DAQ-card to GPS (UTC) time; e.g. for use
in data fusion in post-analysis.
• Time references:
– GPS
– IEEE 1588 master
– IRIG-B sources
Global time – possible implementations
IRIG-B AM
AM = Amplitude Modulation
BCD = Binary Coded Decimal
IRIG-B DC
GPS with NTP-server and IRIG-B output