rtc_set_offset(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 NAME 🌸

okay bestie, this is rtc_set_offset from the Kernel API Manual β€” and it adjusts the duration of the average second. iconic behavior, honestly πŸ’…βœ¨


🌸 SYNOPSIS 🌸

int rtc_set_offset (struct rtc_device *rtc , long offset );

🌸 ARGUMENTS 🌸

  • rtc β€” the rtc device to be used 🫢
  • offset β€” the offset, in parts per billion πŸ’–

🌸 DESCRIPTION 🌸

some rtc's allow an adjustment to the average duration of a second, bestie. why? to compensate for differences in the actual clock rate due to temperature, the crystal, capacitor, etc. πŸŒ‘οΈπŸ’Žβš‘

the adjustment applied is literally this:

t = t0 * (1 + offset * 1e-9)

where t0 is the measured length of 1 RTC second with offset = 0 ⏱️✨

this is the kernel interface to adjust an rtc clock offset. return 0 on success, or a negative number on error. and if the rtc offset is not setable (or not implemented), return -EINVAL 🚨

no cap: negative number = error, and -EINVAL is the "not setable / not implemented" moment 😭

🌸 SEE ALSO 🌸

kernel file ./drivers/rtc/interface.c β€” plus the whole squad: rtc_read_next_alarm(9), rtc_handle_legacy_irq(9), rtc_aie_update_irq(9), rtc_uie_update_irq(9), rtc_pie_update_irq(9), rtc_update_irq(9), rtc_irq_set_state(9), rtc_irq_set_freq(9), rtc_timer_enqueue(9), rtc_timer_remove(9), rtc_timer_do_work(9), rtc_read_offset(9) πŸ¦‹πŸ’œ


source/version is ./drivers/rtc, dated October 2026, and this page is rtc_set_offset(9) β€” bye bestie, go adjust that average second πŸ’–πŸŽ€βœ¨

πŸ“¦ where this page comes from