Hacker News new | past | comments | ask | show | jobs | submit login

Let's talk about the sad state of clocks today. There exists a few ways to query NTP time on Linux. (1) Directly through NTP (2) the adjtimex syscall, (3) the ntp_gettime call. I found it hard to find many codebases using the proper NTP. In fact codebases that need reliable time, like Cassandra and OpenLDAP. don't use NTP time APIs to check whether the system clock is in sync, or to get accurate time. Even if we were to make PTP accessible to the world, it would be some time before its usage actually became ubiquitous. The understandability of time keeping, and clock yielding in our community is a sore point.



I think NTP usually synchronizes the system time, so programs don't have to use any NTP specific API to get NTP time. PTP won't help here: all it does is increase the accuracy from milliseconds to microseconds - not much use if the Linux scheduler tick is 1ms. PTP time is mainly useful together with hardware event timestamping, where stuff like interrupt latency can be excluded. If you want, for example, to send a frame every two seconds as soon as the device boots, you still should use CLOCK_MONOTONIC, otherwise you produce a glitch when PTP ramps up.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: