Small footprint clock synchronization without NTP

后端 未结 6 1813
名媛妹妹
名媛妹妹 2021-01-04 04:47

I\'m looking for a simple clock synchronization protocol that would be easy to implement with small footprint and that would work also in the absence of internet connection,

6条回答
  •  臣服心动
    2021-01-04 04:56

    ntp is the right tool for the job. You do not need an internet connection, and for an extra $105 and a few hours of your life, you can even be GPS synchronized for an absolute time reference without an internet connection, though that appears to not be important to you.

    Ignoring the slight additional complexity of GPS synchronization, you can get synchronized to a chosen system's clock using a few configuration file lines (four lines on each client, five lines on the server). The ntpd binary is 505kB on my system. You can also use ntpdate which can be periodically run to adjust the system clock (zero lines of configuration on the client, other than the call to the ntpdate application with the right arguments). That binary is 80kb. There is a SNTP protocol which allows even smaller footprints for embedded appliations (talking to a normal ntp server). There is also an alternate NTP implementation called chrony.

    There is also a program called rdate (typically only on older systems, though source is available) which works kinda like ntpdate but much less precisely. You also need an RFC 868 server, often provided in inetd.

    The only other alternative is the Precision Time Protocol already mentioned.

提交回复
热议问题