Synchronize local date and time via HTTP headers from web servers.


Synchronize date and time

$ sudo htpdate [host]

Perform simulation of synchronization, without any action
$ htpdate -q [host]

Compensate the systematic clock drift
$ sudo htpdate -x [host]

Set time immediate after the synchronization
$ sudo htpdate -s [host]


htpdate [-046abdhlqstxD] [-i pid file] [-m minpoll] [-M maxpoll] [-p precision] [-P <proxyserver>[:port]] [-u user[:group]] <host[:port]> ...


The HTTP Time Protocol (HTP) is used to synchronize a computer's time with web servers as reference time source. Htp will synchronize your computer's time to Greenwich Mean Time (GMT) via HTTP headers from web servers. The htpdate package includes a program for retrieving the date and time from remote machines via a network. Htpdate works through proxy servers. Accuracy of htpdate will be usually within 0.5 seconds (better with multiple servers). If this is not good enough for you, try the ntpd package.



HTTP/1.0 request (default is HTTP/1.1).


Force IPv4 name resolution only. Default behaviour is to try IPv6 first and fall back to IPv4.


Force IPv6 name resolution only.


Adjust time smoothly (default in daemon mode).


Burst mode uses multiple polls for each web server to enhance accuracy.


Turn debug on. Shows the "raw" timestamp, round trip time, time delta and and basic statistics of web server responses. Useful to determining the quality of a specific web server as time source.


Show help.


Set the pid file (default /var/run/


Use syslog for output (levels LOG_WARNING and LOG_INFO). Convenient if you use htpdate from cron.

-m -M

These options specify the minimum (-m) and maximum (-M) polling intervals for HTP requests, in seconds. The default range is between 30 minutes and 32 hours. Htpdate calculates the optimal polling frequency between minimum and maximum values. Only applicable when running in daemon mode.


Precision (in milliseconds) specifies the operating accuracy of htpdate. Internally htpdate uses a different algorithm to detect a time offset, when precision is specified. Precision only has effect in daemon mode. Use with caution.


Query web server and display time, but do not change time (default in interactive mode).


Set time immediate. In daemon mode -s only applies the first poll.


Turn off sanity time check. By default a time offset larger than a year, compared to current localtime, is rejected. With -t set, any time stamp will be accepted.


Set the user and group that the server normally runs at (default is root).


Let htpdate compensate for the systematisch clock drift.


Run as daemon (requires root privileges).


Proxy server hostname or ip-address.


Web server hostname or ip-address. Up to 16 hosts may be specified, but in general 3 to 5 hosts should be enough for a redundant and accurate setup.


Portnumber (default 80 and 8080 for proxy server)


Request time from web server (don't update local clock):
htpdate -q

Verbose output (don't update local clock):
htpdate -d -q

Adjust time smoothly and log output to syslog (eg. cron):
htpdate -a -l

HTTP/1.0 request in IPv6 literal format (RFC 2732):
htpdate -0 [2001:DB8:1af6::123]:80

Run htpdate as daemon:
htpdate -D

Daemon mode for the security minded:
htpdate -D -u nobody:nogroup


rdate, timed, ntpd, adjtimex, ntp_adjtime, HTP implementation by Roy Keene (


Eddy Vervest <>,

Copied to clipboard