kb:public_utilitiy_programs:kernel-time-state_-_clock_state_of_linux_unix_kernels

'kernel-time-state' - Clock State of Linux/Unix Kernels

The command line utility program kernel-time-state allows to check or modify the time synchronization state of operating systems that support the adjtimex API call (e.g. on Linux), or the equivalent ntp_adjtime API call (e.g. on FreeBSD or NetBSD).

The kernel's time synchronization state includes leap second announcements, the kernel's TAI offset, etc., and is usually updated by time synchronization software like ntpd, chronyd, or ptpd.

Of course root permissions are required to write any changes to the kernel.

A source code package is available here:

Just unpack the archive file and run make in the extracted directory to build the program.

Yet there is no make install, so the compiled binary should be manually copied to /usr/local/bin or /usr/local/sbin.


Here are some example commands:

kernel-time-state -?      # Print some usage information
kernel-time-state -s      # Show some status information
kernel-time-state -T 37   # Set the kernel's TAI offset to 37 s
kernel-time-state -t      # Show current UTC and TAI time
kernel-time-state -c      # Run continuously, e.g. to watch leap second handling by the kernel


The KB article Leap Second Handling by the Linux Kernel for example shows the behavior of a Linux kernel across a leap second.

Martin Burnicki martin.burnicki@meinberg.de 2019-06-06

  • kb/public_utilitiy_programs/kernel-time-state_-_clock_state_of_linux_unix_kernels.txt
  • Last modified: 2020-09-21 12:45
  • by 127.0.0.1