←back to thread

221 points mfiguiere | 1 comments | | HN request time: 0.001s | source
Show context
kazinator ◴[] No.33696172[source]
It is not accurate to say that PTP is a predecessor to NTP.

You need both.

PTP synchronizes clocks to a ridiculous precision, like down to nanoseconds. To do that, it uses support in the ethernet hardware. Hardware adds precision stamps to the PTP-related ethernet frames, so that the time calculations are free of jitters induced by the higher network stacks.

A cool thing is that PTP-aware routers/switches can actually rewrite the timestamps in PTP packets to subtract their own propagation delay accurately.

Something in the network has to use NTP, if it is important for the devices to have the correct calendar date and time; you don't use PTP over the Internet to get time from a remote server.

The real-time clock being synchronized isn't even the system clock in the first place, but a high resolution RTC that is in the network adapters and switches.

As an additional utility on top of the PTP stack, there is the possibility of synchronizing the host system's clock with the help of PTP.

PTP is used for things like generating precise signals in certain applications. E.g. Some devices that have PTP support can be programmed to generate periodic pulses which are clocked by the sychronized real-time clock. With PTP, two such signals from separate devices on the network can align very precisely. Such an application doesn't care about the time of day, just that the signals are synced.

replies(1): >>33696839 #
willis936 ◴[] No.33696839[source]
Just because high precision tasks don't care about time of day as much, PTP still uses TAI timestamps. The only time of day information missing is leap seconds, and those were a mistake that is being corrected. You don't need NTP for time of day when PTP is used.
replies(2): >>33699341 #>>33716131 #
zie ◴[] No.33699341[source]
The point being you need a source of truth for PTP to figure out what the current date and time are. You won't be pushing PTP over the public internet, that's ridiculous. You can use a GPS/sat sync or atomic clock or NTP, doesn't matter, but something has to tell PTP what time it is. If you don't, then you will be subject to quartz crystal drift. It may or may not matter to your application(s), but for most people that care about time, they want the TAI timestamps to be at least reasonably accurate.
replies(1): >>33712691 #
willis936 ◴[] No.33712691{3}[source]
Is that really useful though? As soon as you need to synchronize your dataset beyond the local PTP network NTP-based timestamping becomes useless. You need a local GPS-based time reference backing PTP.
replies(2): >>33716137 #>>33720946 #
1. zie ◴[] No.33720946{4}[source]
It totally depends on your use case, and what you actually need in reality.

In general, once you need/want anything past what NTP can deliver for you, you really, really need to understand your use case and then design your time services to meet your specific needs.