Scroll to navigation

HTPDATE(8) System Manager's Manual HTPDATE(8)

NAME

htpdate - Time synchronization (daemon)

SYNOPSIS

htpdate [-046acdhlnqstvxDF] [-f driftfile] [-i pidfile] [-m minpoll] [-M maxpoll] [-p precision] [-P <proxyserver>[:port]] [-u user[:group]] <URL> ...

DESCRIPTION

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 using the Greenwich Mean Time (GMT) HTTP headers timestamp from web servers. HTTP and HTTPS are both supported.

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, use a ntp package like ntpd, OpenNTPD or chrony.

OPTIONS

-0
HTTP/1.0 request (default is HTTP/1.1).
-4
Force IPv4 name resolution only. Default behaviour is to try IPv6 first and fall back to IPv4.
-6
Force IPv6 name resolution only.
Adjust time smoothly (default in daemon mode).
Verify server certificate (default no verification).
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. Multiple -d options increase verbosity. The maximum is 3.
Read/write the systematic drift of the system clock. See also -x.
Show help.
Set the pid file (default /var/run/htpdate.pid).
Use syslog for output (levels LOG_WARNING and LOG_INFO). Convenient if you use htpdate from cron.
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.
Don't use a proxy, even if the appropriate http_proxy environment variable is defined.
Precision determines the operating accuracy of htpdate. Precision specifies the number of steps (default 4, maximum of 9) for htpdate to determine the second boundary.
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).
Show version.
Let htpdate compensate for the systematisch clock drift by adjusting system clock frequency.
Run as daemon. This option requires root privileges.
Run daemon in foreground. Daemon will not fork or write PID file. This option 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.
Port number (default 80 and 8080 for proxy server).
Path to resource (e.g. /index.html).

ENVIRONMENT

Htpdate supports proxies for HTTP connections. The standard way to specify the proxy location, which htpdate recognizes, is using the following environment variable:

If set, the http_proxy variable should contain the URL of the proxy for HTTP connections.

EXAMPLES

Request time from web server (don't update local clock):
htpdate www.example.com

Request time from multiple web servers:
htpdate www.example.com https://example.com http://example.com:80

Debug output (don't update local clock):
htpdate -d www.example.com

Adjust time smoothly and log output to syslog (eg. cron):
htpdate -al www.example.com:80/htpdate.html

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

Run htpdate as daemon:
htpdate -D https://www.example.com

Run htpdate in the foreground with all output going to the terminal:
htpdate -F www.example.com

Read clock drift during start of htpdate and update when a new value has been established:
htpdate -Dx -f /etc/htpdate.drift www.example.com

Daemon mode for the security minded:
htpdate -D -u nobody:nogroup www.example.com

AUTHOR

Eddy Vervest <eddy@vervest.org>, http://www.vervest.org/htp

SEE ALSO

rdate, timed, ntpd, OpenNTPD, chrony, adjtimex(8), ntp_adjtime,

version 1.3.5 htpdate