STRUCT NTP_DATA(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– struct ntp_data(9) πŸ’–

okay so bestie, welcome to the Kernel API Manual β€” this one's literally the struct ntp_data page and it's holding all the NTP state, like the whole personality of your kernel's clock sync in one struct. πŸ•°οΈβœ¨


✨ NAME ✨

struct ntp_data β€” the structure holding all NTP related state 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

struct ntp_data {
    unsigned long           tick_usec;
    u64 tick_length;
    int time_state;
    int time_status;
    s64 time_offset;
    s64 skew_delta;
    long time_constant;
    long time_maxerror;
    long time_esterror;
    s64 time_freq;
    time64_t time_reftime;
    long time_adjust;
    s64 time_adjust_frac;
    s64 ntp_tick_adj;
    s64 cs_tick_adj;
    time64_t ntp_next_leap_sec;
  #ifdef CONFIG_NTP_PPS;
    int pps_valid;
    long pps_tf[3];
    long pps_jitter;
    struct timespec64       pps_fbase;
    int pps_shift;
    int pps_intcnt;
    s64 pps_freq;
    long pps_stabil;
    long pps_calcnt;
    long pps_jitcnt;
    long pps_stbcnt;
    long pps_errcnt;
  #endif;
   };

ngl that #ifdef CONFIG_NTP_PPS; block is giving "only some of us are invited to the PPS party" energy πŸ’… β€” everything from pps_valid down to pps_errcnt only shows up when that config's on.


πŸŽ€ Members πŸŽ€

time to meet the cast, iykyk πŸ’–

  • tick_usec β€” the USER_HZ period, in microseconds ⏱️
  • tick_length β€” tick length in ns, lowkey << NTP_SCALE_SHIFT-ed
  • time_state β€” the state of the clock synchronization, like its current mood 🌈
  • time_status β€” clock status bits
  • time_offset β€” time adjustment, in nanoseconds
  • skew_delta β€” per-tick phase slew rate for the coming second, measured in time_offset units (so: shifted-ns / HZ). Set by second_overflow. πŸ‘‘
  • time_constant β€” the PLL time constant
  • time_maxerror β€” maximum error in microseconds, holding the NTP sync distance (that's NTP dispersion + delay / 2) 😭
  • time_esterror β€” estimated error in microseconds, holding the NTP dispersion
  • time_freq β€” frequency offset scaled nsecs/secs
  • time_reftime β€” time at the last adjustment, in seconds
  • time_adjust β€” the adjustment value
  • time_adjust_frac β€” the sub-microsecond remainder of time_adjust being delivered, in ns << NTP_SCALE_SHIFT (and no, it is not divided by HZ 🫢)
  • ntp_tick_adj β€” constant boot-param configurable NTP tick adjustment (upscaled)
  • cs_tick_adj β€” a fixed per-second adjustment compensating for the difference between the nominal NTP interval and the real time taken by the clocksource's integer cycle_interval (upscaled). Set by the timekeeping core via ntp_clear. ⭐
  • ntp_next_leap_sec β€” second value of the next pending leapsecond, or TIME64_MAX if there's no leap 🌸
  • pps_valid β€” PPS signal watchdog counter πŸ•
  • pps_tf β€” PPS phase median filter
  • pps_jitter β€” PPS current jitter, in nanoseconds
  • pps_fbase β€” PPS beginning of the last freq interval
  • pps_shift β€” PPS current interval duration in seconds (it's a shift value, bestie)
  • pps_intcnt β€” PPS interval counter
  • pps_freq β€” PPS frequency offset, in scaled ns/s
  • pps_stabil β€” PPS current stability, in scaled ns/s
  • pps_calcnt β€” PPS monitor: calibration intervals πŸ“Š
  • pps_jitcnt β€” PPS monitor: jitter limit exceeded
  • pps_stbcnt β€” PPS monitor: stability limit exceeded
  • pps_errcnt β€” PPS monitor: calibration errors

πŸ’œ Description πŸ’œ

Protected by the timekeeping locks. πŸ”’ that's it, that's the whole vibe β€” but fr fr do not go poking at this without holding them.


🌟 SEE ALSO 🌟

Kernel file ./kernel/time/ntp.c, plus pps_clear(9), ntp_clear(9), ntp_get_next_leap(9), ntp_synced(9) β€” go read those, they ate πŸ’…πŸ”₯


and that's the page bestie!! πŸŽ€ from ./kernel/time, dated October 2026 β€” the struct ntp_data(9) era, periodt. βœ¨πŸ¦‹πŸ’–

πŸ“¦ where this page comes from