Htpdate


Intro

The HTTP Time Protocol (HTP) is used to synchronize a computer's time with web servers as reference time source. The htpdate utility retrieves the date and time from remote web servers via the network. Htpdate works through proxy servers as it behaves similar to a browser. Accuracy of htpdate will be usually within 0.5 seconds (better with multiple servers).

Time synchronization protocols

Many implementations exist for time synchronisation between computers over a network. Below you will find a short list of popular network protocols which are in use today:

daytime (RFC 867) protocol sends a human readable string when connecting to UDP or TCP port 13

> telnet time.nist.gov 13
Trying 2610:20:6f15:15::27...
Connected to time.nist.gov.
Escape character is '^]'.

56941 14-10-11 14:42:10 23 0 0 252.1 UTC(NIST) * 
Connection closed by foreign host.

time (RFC 868) protocol is similar to the daytime protocol described above and used by rdate. The format of the time given by the time server is in "computer readable" format.

timed daemon uses ICMP messages for time synchronization. Most routers and hosts don't support ICMP timestamp requests.

NTP (RFC 1305, RFC 2030, www.ntp.org, chrony) is the most popular time synchronization protocol in use nowadays. NTP has good accuracy (milliseconds across Internet and microseconds or less in LAN environments) with only a small amount of network traffic.

Time synchronization with NTP

Why would anybody need another time protocol, when NTP is already great? A simple answer is "you don't", unless you don't have access to a NTP server, because you are behind a firewall and/or proxy server.

In order for NTP to work, you need to have access to outgoing and incoming packets from UDP port 123. In most corporate environments this is not the case and you must consider yourself lucky if you have Internet access via an HTTP proxy server. As long as HTTP connectivity is available, you can use HTP/htpdate.

Source

Starting version 1.2.3 development takes place on github.

About latest release 2.0.0

The 20 year anniversary edition!

Downloads

All (previous) versions can be found here

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. http://www.gnu.org/copyleft/gpl.html

Binaries

httpdate uses libcurl and is more accurate (but doesn't run as daemon)

Version 1.2.2 of htpdate has been forked by Angelo Compagnucci.

Htpdate as part of NTP pool

Htpdate is part of the NTP pool project! Currently chronyd is configured without any servers (or peers)... just htpdate for time keeping.

A typical startup sync sequence when htpdate is started on a system with a large clock drift... it can take some time to adjust using the -x option.

htpdate at NTP Pool

System

Raspberry Pi 3 Model B+ with Debian "Bookworm"

Server (serving time to NTP clients)

Chrony configured with,

local stratum 5
driftfile /dev/null

Client (synchronizing system time)

htpdate development release version 1.x.x running as follows,

htpdate -Dxd -p 7 -f /etc/htpdate.drift ... ...

Live graphs

ntp6.vervest.org statistics on NTP Pool