CLOCKDIFF(8)

πŸ“¦
this version Β· 6 versions
, in alpine 3.24, arch rolling, fedora 43, fedora 44, nixpkgs unstable, ubuntu resolute, ubuntu stonking

πŸ’– CLOCKDIFF(8) πŸ’–

okay bestie, gather round, we're doing the clockdiff page from iputils and it's lowkey iconic. this is section 8, so it's a sysadmin situation, and it's literally about figuring out how far apart two clocks are. clock girl summer fr fr πŸ•βœ¨


✨ NAME ✨

clockdiff β€” measure clock difference between hosts 🫢


🌸 SYNOPSIS 🌸

clockdiff [-o] [-o1] [--time-format ctime iso] [-V] {destination}

πŸ¦‹ DESCRIPTION πŸ¦‹

So the whole vibe of clockdiff is: it measures the clock difference between us and destination, with 1 msec resolution. how does it do that? it uses ICMP TIMESTAMP packets [2] or, optionally, the IP TIMESTAMP option [3] added to an ICMP ECHO. [1] it's giving "detective but make it packets". no cap πŸ’…


πŸ’œ OPTIONS πŸ’œ

  • -o β€” uses IP TIMESTAMP with ICMP ECHO instead of ICMP TIMESTAMP messages. this one is useful with certain destinations that do NOT support ICMP TIMESTAMP (f.e. Solaris <2.4). some hosts are just built different, and not in a good way πŸ™ˆ
  • -o1 β€” slightly different form of -o, namely it uses three-term IP TIMESTAMP with prespecified hop addresses instead of the four-term one. which flavor works better depends on the target host. particularly, -o is better for Linux. ✨
  • -T, --time-format ctime iso β€” prints the time stamp in the output either in ISO-8601 format or in classic ctime format. the ctime format is the default. the ISO time stamp includes the timezone, and it's easier to parse. periodt πŸ“…
  • -I β€” alias of the --time-format iso option and argument. cute shortcut energy πŸŽ€
  • -h, --help β€” prints help and exits. queen behavior πŸ‘‘
  • -V, --version β€” prints version and exits. πŸ’«

😭 WARNINGS 😭

  • Some nodes (Cisco) use non-standard timestamps, which is allowed by RFC, but makes timestamps mostly useless. πŸ’€
  • Some nodes generate messed timestamps (Solaris>2.4), when run xntpd. Seems its IP stack uses a corrupted clock source, which is synchronized to time-of-day clock periodically and jumps randomly, making timestamps mostly useless. good news is that you can use NTP in this case, which is even better. 🌈
  • clockdiff shows difference in time modulo 24 days. yeah. 24 days. do with that what you will bestie 😌
ngl the Cisco one and the Solaris one are giving "we tried our best and our best was not enough". but hey, NTP ate and left no crumbs.

πŸ‘‘ SEE ALSO πŸ‘‘

ping(8), arping(8), tracepath(8).


πŸ“š REFERENCES πŸ“š

[1] ICMP ECHO, RFC0792, page 14.

[2] ICMP TIMESTAMP, RFC0792, page 16.

[3] IP TIMESTAMP option, RFC0791, 3.1, page 16.


🧚 AUTHOR 🧚

clockdiff was compiled by Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>. It was based on code borrowed from the BSD timed daemon. the way this was literally built on borrowed code and still slayed β€” respect 🫑


πŸ”₯ SECURITY πŸ”₯

clockdiff requires CAP_NET_RAW and CAP_SYS_NICE capabilities to be executed. It is safe to be used as set-uid root. yes bestie, set-uid root and it's SAFE, we love a responsible icon πŸ’–


🌟 AVAILABILITY 🌟

clockdiff is part of the iputils package. πŸ’«


aaaand that's the whole page, you ate that fr fr πŸ’…βœ¨ this is iputils version 20250605, dating all the way back to 20250605, so go forth and measure some clocks, bestie πŸ•°οΈπŸ¦‹πŸ’–

πŸ“¦ where this page comes from