Presentation is loading. Please wait.

Presentation is loading. Please wait.

Accurate Time, and Timestamps What’s in your metadata?

Similar presentations


Presentation on theme: "Accurate Time, and Timestamps What’s in your metadata?"— Presentation transcript:

1 Accurate Time, and Timestamps What’s in your metadata?
Assured Access to Accurate Time Workshop 22 June 2018 Accurate Time, and Timestamps What’s in your metadata? John Harrison ( ) wanted to solve the problem of accurate timekeeping to help with navigation. One of his contemporaries was Samuel Johnson ( ), who once wrote: Ye who listen with credulity to the whispers of fancy, and pursue with eagerness the phantoms of hope; who expect that age will perform the promises of youth, and that the deficiencies of the present day will be supplied by the morrow, attend to the history of Rasselas, Prince of Abyssinia. 1

2 What I'm gonna say NTF: What, Why, Who.
A bit about time: limits and presumptions. When? PTP, and NTP. Using Time, Timestamp basics. Adjusting System Time. Leapseconds. Using Timestamps, tracking error. Timescales. POSIX. New issues, how does this help? Certification and Compliance Free/Paid Timestamps. 2

3 Why NTF? The NTP Project has been around for over 30 years’ time, and needed the support and backing of a legal entity. I felt an “NTP Foundation” would have insufficient scope. PTP has been around since before 2002. Network Time Foundation seemed “right”. NTF is a 501(c)(3) US Nonprofit, as of June of 2011. 3

4 Who/What is NTF? NTF currently supports NTP, Ntimed, LinuxPTP, and the General Timestamp API projects. Looking to start a “Stratum 0 Consortium.” Developing Certification and Compliance programs. Relative and Absolute Difference Clock 4

5 Wrenches As clocks improve, the definition of “time” improves, and paradoxically also becomes less clear. We now have clocks that can show how time passes more quickly on the ceiling than it does on the floor. 5

6 More Wrenches From an article in 2012:
“At the University of Pittsburgh, researchers used a NIST-produced atomic clock the size of a grain of rice to map variations in the magnetic field of a mouse's heartbeat. They placed the clock 2 mm away from the mouse's chest, and watched as the mouse's iron-rich blood threw off the clock's ticking with every heartbeat.” NTP assumes its running on a “sane and stable” machine and it uses this assumption to judge the validity of the other systems it talks to. We will likely need to change this assumption to let trusted(!) others let us know if they believe we are “off”. 6

7 Time: When? “Knowing the time” is important because we can note when something happened, and we can plan when to do something. This requires dissemination of the time, and timestamps that contain “enough” information to be generally useful. “Time” means different things to different people.

8 PTP v. NTP: Network Refclocks can produce NTP and PTP timestamps to the same precision. Networks designed to support PTP have routers and switches that use BC/TC to maintain accurate time thru the network. Proposals for “hop delay tracking” for NTP are being explored. Each “plain” switch and router introduces arbitrary delays and jitter. Asymmetric.

9 PTP v. NTP: System PTP disciplines the clock in the network interface. A PTP-capable network interface has its clock close to the actual network connection. There are some delays and jitter when the OS interacts with the PTP clock. NTP disciplines the system clock. The system clock is generally on the motherboard. There are some delays and jitter when the OS interacts with the system clock. There are layers of delays and jitter when moving “time” around, inside the system.

10 PTP and Time There is a fixed delay and low jitter when moving “time” between two PTP NICs connected by a wire. PTP started at the bus level, and is moving ‘up’ the network stack. PTP timestamp accuracy is lost as packets travel across non-PTP interconnects.

11 NTP and Time NTP’s goals are to:
Steer the system clock towards the best concept of correct time. Respond well to an “impulse”. NTP works demonstrably well over LANs, WANs, and in Space. The better we can track delays, noise, and jitter, the better NTP can do its job. 30 years’ ago, NTP kept machines synchronized to about .1 sec. Today, sub-millisecond synchronization is easy, and with interleaved mode we can do better.

12 What Time is it? Yogi Berra was once asked this. His response:
“You mean now?” I submit the better question is: What time was it?

13 Why care about When? Timestamps are about “When”.
We care about them because we either: Want to do something then. Want to know when something happened. Timestamps happen in an instant. How can we decide how accurate the timestamp was? How do we and others (re)assure ourselves about the quality of the timestamp?

14 Using Time It was easier to use “time” when the wobbles were in the noise. Timescales solve different problems for different groups. Problems occur when different groups disagree about “signal” and “noise”. Larry McVoy likes: In theory, theory and practice are the same. But in practice they are not. Antarctic Circumpolar Current. The jetstreams. Earthquakes and plate shifts. The Chilean earthquake sped up the rotation of the earth (shortened the day) by over a microsecond. Ditto for the quake in Japan. The Sumatra earthquake shortened the length of a day by nearly 7 microseconds.

15 Presumptions If we’re on a computer and we need to know what time it is, we ask for a timestamp. We simply assume the answer we get is correct. What other choice do we have? Do we even consider any other conditions? And later, when we use the timestamp? When somebody else uses the timestamp?

16 Current Timestamps Current timestamps are mostly OK for “local use”. Mostly. seconds since some epoch <days since epoch>,<seconds since midnight> YYYYMMDD-HHMMSS

17 Timestamp Issues Monotonic time and databases.
System time may be known to be undergoing a correction. Leapsecond? Error bounds? Provenance? What timescale is being used? When comparing T0 and T1 did anything happen between those events that would affect the comparison? Did the clock change? Different timescales?

18 Timestamp Metadata A “clock discontinuity counter” is needed to show where “time steps” have occurred, and their magnitude. A “host ID” is useful when comparing timestamps between multiple systems. A “clock ID” is useful if we need to know what the host is using to track the time.

19 About that Clock ID… With what degree of specificity should we know the source of time? Multiple choice question: Is 13 microseconds very much time?

20 26 Jan 2016 and GPS SVN 23 was the oldest GPS satellite still in operation on 26 Jan 2016, at the time it was being decommissioned. During that process, the legacy L-band signal was off by 13 microseconds from 00:49 MST until 06:10 MST. 13 microseconds could cause a position error of just under 4km / 2.5 miles. Self driving cars!

21 Timestamps and... Virtual Machines generally aren't “smooth” with time
What about “teleporting” a VM and its IP to another physical host somewhere else on the network? This also affects NTP... Laptops (at least) sometimes go to sleep, and sometimes change timezones (travel).

22 Timestamp Structure System time (or Elapsed time)
Amount of pending correction Leapsecond correction (optional) Expected/Maximum error Timescale (and its revision #) Clock discontinuity, boot counters Host and Clock ID Provable Signature Structure/API Version number, Flags

23 Putting it to Use A new timestamp structure is only useful if it can be widely and generally portable: Kernel support Library support Application support (NTP, SQL, etc.)

24 Adjusting System Time Forward: Backward:
Adjust “system time”, or Increase “amount of pending correction” Backward: Decrease “amount of pending correction” The OS applies pending corrections according to its policy rules. … and the timestamp structure can report these pending corrections.

25 Adjusting System Time Forward time adjustments seem to be pretty straightforward. Backward time adjustments are more challenging, as monotonic time is generally “good”. If we want to step the time backwards, make tiny advances to the system clock when needed and decrease the pending correction by 1 second per second. NTP used to report the system's idea of “correct time”, ie “system time + correction”. Now it only reports “system time”. DLM had good reasons for this change, and that was years ago.

26 Leapsecond Timestamp Example
{System Time, Offset to Correct Time} UTC NTP-DLM (POSIX) NTP-Windows59 NTP-Windows58 SMEAR24H SMEAR1212 00:00:00.00 {00:00:00.00, 0} 06:00:00.00 {06:00:00.00, 0} {05:59:59.75, .25} 12:00:00.00 {12:00:00.00, 0} {11:59:59.50, .50} 18:00:00.00 {18:00:00.00, 0} {17:59:59.25, .75} {17:59:59.75, .25} 23:59:59.00 {23:59:59.00, 0} {23:59:59.00, .00} {23:59:58.00, 1} {23:59:58.50, .5} 23:59:59.50 {23:59:59.50, 0} {23:59:59.50, .25} {23:59:59.00, .5} {23:59:59.99, .0} {23:59:59.99, .50} {23:59:59.00, .0} {23:59:59.50, .5} {23:59:59.99, .5} {23:59:59.99, .25} {23:59:59.99, .75} {23:59:59.50, .0} {23:59:59.99, 1} {00:00:00.00, -.50} {00:00:00.50, -.5} 00:00:00.50 {00:00:00.50, 0} {00:00:00.50, -.25} {00:00:01.00, -.5} 00:00:01.00 {00:00:01.00, 0} {00:00:01.50, -.5} {06:00:00.25, -.25} {12:00:00:00, 0} The non-UTC values are not in canonical form. I'm not real happy with the SMEAR24 numbers for the last two seconds of the day. There are worse problems with SMEAR In theory, these timestamps are never off by more than a half of a second. But that falls apart during the leap second.

27 Using timestamps The timestamp library API needs to handle:
Adding/subtracting timestamps Must accumulate error budgets Canonicalization of timestamps Comparing timestamps Converting timestamps (timescales) Quality metric reporting Comparing timestamps becomes more interesting when including error bounds.

28 Timestamp Arithmetic TA – Absolute Timestamp TD – Difference Timestamp
TA - TA = TD TA +/- TD = TA TD +/- TD = TD Of course, proper “accounting” of error budgets must be maintained.

29 Timestamp Error Budgets
NTP assumes that clocks accumulate error at the rate of 15ppm, by default. The initial error budget for a Difference timestamp is 0. We usually care more about the magnitude of the error instead of the error value. 15ppm (PHI) was an engineering estimate made years ago. It may or may not still be correct, and it may or may not be generally applicable.

30 Timescale Database I’m operating on the belief that a timescale database won’t be that much harder to implement and maintain than Arthur David Olson’s Timezone Database. There are groups actively working on tzdata dissemination.

31 Initial Timescales Rare changes TAI/Satellite time (GPS, ...)
Martian Standard Time UTC (leapseconds) Local Timezones (tzdata) IERS-A Frequent changes

32 Timescale Identification
While it's overkill and likely way more than we need, using the 32-bit internet network class stuff is a useful way to start thinking about the problem. The “network” portion can specify the timescale, and the “host” portion can specify the version of the timescale. UTC gets leapsecond corrections about every 2 years' time. Tzdata seems to be updated about 20 times/year. IERS-A gets updated every week.

33 Ongoing Questions POSIX mostly decided upon absolute event timers. It would be nice if we could come up with a mechanism to notify a process that the system time had changed so that the application had a way to decide if it wanted to adjust its events or not. What about SIGWOKEUP, SIGTIMECHG? After a wakeup, some events might be timed with “difference” timestamps with 0 being the moment the system “woke up”. These timestamps can be adjusted to absolute timestamps once we have valid time synch. Similarly, we might want to make other adjustments if the time was “changed”. 33

34 How does this help? Poor timekeeping and timestamps can be incredibly costly and terribly inefficient. Power Grid Failure Hospital E/R and healthcare data Vehicle Fleet Tracking 34

35 Certification and Compliance
Being able to use a timestamp in a “provable” setting is very helpful. For a timestamp to be “provable” it needs to contain enough information to sufficiently understand its provenance, and know its boundaries and limits. GTSAPI. The entire “time chain” for the timestamp must be traceable and provable. 35

36 Free vs. Paid Time Free timestamps must always be available.
A “gift” comes with no implied warranty. Timestamps that cost money (even US$0.01 each) would be provable, traceable, and include liability insurance. The revenue from these would also help support Network Time and the time infrastructure. 36

37 Summary NTF: What, Why, Who.
A bit about time: limits and presumptions. When? PTP, and NTP. Using Time, Timestamp basics. Adjusting System Time. Leapseconds. Using Timestamps, tracking error. Timescales. POSIX. New issues, how does this help? Certification and Compliance Free/Paid Timestamps. 37

38 Help NTF Help You Visit and learn more about these issues and Network Time Foundation. Join NTF and invite others to join, too! Help NTF help you! I'm not going to directly ask you to support NTF. Having said that, if you think you can't support us because you don't have budget, I have great news – you CAN help! You can participate. You can tell others about the work we're doing and encourage them to support us. I bet you can think of other ways, too. Please let us know – we're happy to help you to help us to help you with Network Time! 38


Download ppt "Accurate Time, and Timestamps What’s in your metadata?"

Similar presentations


Ads by Google