htpdate  1.3.7
About: HTPdate (HTTP Time Protocol) synchronizes a computer’s time with web servers as reference time source (working through proxy servers).
  Fossies Dox: htpdate-1.3.7.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Loading...
Searching...
No Matches
htpdate Documentation

Some Fossies usage hints in advance:

  1. To see the Doxygen generated documentation please click on one of the items in the steelblue colored "quick index" bar above or use the side panel at the left which displays a hierarchical tree-like index structure and is adjustable in width.
  2. If you want to search for something by keyword rather than browse for it you can use the client side search facility (using Javascript and DHTML) that provides live searching, i.e. the search results are presented and adapted as you type in the Search input field at the top right.
  3. Doxygen doesn't incorporate all member files but just a definable subset (basically the main project source code files that are written in a supported language). So to search and browse all member files you may visit the Fossies htpdate-1.3.7.tar.gz contents page and use the Fossies standard member browsing features (also with source code highlighting and additionally with optional code folding).
README.md

htpdate

main

Time synchronization... quick and dirty

date -s "`curl --head -s https://example.com | grep -i "Date: " | cut -d' ' -f2-`"

Better solution... htpdate

The above one-liner might result in unexpected behavior,

  • site is not reachable
  • site has wrong time
  • steps/jumps (backwards!) in time

htpdate solves that by allowing multiple URLs as time source, eliminating 'false tickers', gradually adjusts time and run indefinitely as daemon.

The HTTP Time Protocol (HTP) is used to synchronize a computer's time with web servers as reference time source. Htpdate will synchronize your computer's time by extracting timestamps from HTTP headers found in web server responses. Htpdate can be used as a daemon, to keep your computer synchronized. The accuracy of htpdate is at least -+0.5 seconds, but can be in the range of ~10 ms (see -p option). If this is not good enough for you, use a ntp package.

Install the htpdate package if you need tools for keeping your system's time synchronized via the HTP protocol. Htpdate works also through proxy servers.

Installation

build:

make

or for HTTPS support (OpenSSL is required)

make https

install:

make install

Usage

Htpdate can be used to query the time of one of more web servers,

htpdate www.example.com http://www.example.com https://example.com

Htpdate can run as daemon,

htpdate -D http://www.example.com

Another option is to run htpdate periodically from cron. For a daily time synchronization,

5 3 * * * /usr/sbin/htpdate -a www.example.com

All htpdate options,

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

See manpage for more details.

See also