A simple time client to fetch and optionally set system time from NTP, HTTP, Daytime, or Time Protocol sources.
go install github.com/earentir/ntpcl@latestOr build from source:
git clone https://github.com/earentir/ntpcl.git
cd ntpcl
go build -o ntpcl ../ntpclQueries europe.pool.ntp.org and prints a table with server time, local time, offset, RTT, and NTP details.
sudo ./ntpcl --set
./ntpcl ntp pool.ntp.org --set
./ntpcl --set ntp pool.ntp.orgPersistent flags work before or after the subcommand.
./ntpcl ntp pool.ntp.org --high-accuracy
sudo ./ntpcl ntp pool.ntp.org --high-accuracy --setCollects multiple spaced NTP samples, drops outliers, and uses the median offset.
./ntpcl http https://example.com
./ntpcl daytime time.nist.gov
./ntpcl time time.nist.gov
./ntpcl windows-time dc.example.comwindows-time queries a Windows Time host over unsigned NTP. It is not MS-SNTP authenticated.
./ntpcl --dry-run --set ntp pool.ntp.org
./ntpcl --max-delta 5s --set ntp pool.ntp.org
./ntpcl --force --set http https://example.com--dry-runshows what would be set without changing the clock--max-deltarefuses large clock steps (default 1s; 100ms in high-accuracy mode)--forceoverrides max-delta and high-RTT checks for coarse sources
./ntpcl --format json ntp pool.ntp.org
./ntpcl --format unix ntp pool.ntp.org
./ntpcl --format rfc3339 --quiet ntp pool.ntp.org
./ntpcl --no-color ntp pool.ntp.orgsudo ./ntpcl --set --system-tools ntp pool.ntp.orgUses date on Linux/macOS or PowerShell Set-Date on Windows instead of direct syscalls.
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Usage error |
| 3 | Network error |
| 4 | Invalid time / refused clock step |
| 5 | Permission denied |
MIT — see LICENSE.