ktime_get_boot_fast_ns(9)
π ktime_get_boot_fast_ns β Kernel API Manual (9)
okay so bestie, we're in the Kernel API Manual today and the star of the show is ktime_get_boot_fast_ns. buckle up, it's giving very niche-king behavior and honestly? iconic. π
β¨ NAME β¨
ktime_get_boot_fast_ns β NMI safe and fast access to boot clock.
like, it gets you the boot clock, it's NMI safe, and it's fast fast. no cap. π¨
πΈ SYNOPSIS πΈ
u64 notrace ktime_get_boot_fast_ns (void );
literally that's it. notrace because we said so, u64 because the number is chunky, (void) because she takes nothing. π
π¦ ARGUMENTS π¦
voidβ no arguments. that's it. she serves looks and returns a value, zero input needed. main character energy fr fr π«Ά
π DESCRIPTION π
so here's the tea, bestie β β to keep it NMI safe since we're accessing from tracing, we're not using a separate timekeeper with updates to monotonic clock and boot offset protected with seqcounts. like, we simply chose not to. and that has the following minor side effects (say it with me: "minor" π):
(1) its possible that a timestamp be taken after the boot offset is updated but before the timekeeper is updated. if this happens, the new boot offset is added to the old timekeeping making the clock appear to update slightly earlier:
CPU 0
CPU 1 timekeeping_inject_sleeptime64 __timekeeping_inject_sleeptime(tk,
delta); timestamp; timekeeping_update_staged(tkd, TK_CLEAR_NTP...);
(2) On 32-bit systems, the 64-bit boot offset (tk->offs_boot) may be partially updated. since the tk->offs_boot update is a rare event, this should be a rare occurrence which postprocessing should be able to handle. rare on rare, lowkey a vibe, but still β heads up π
and the caveats vs. timestamp ordering as documented for ktime_get_mono_fast_ns apply as well. go read that one too, i'm not mad, i'm just saying π
β οΈ real talk: those two side effects are genuinely there. don't act surprised when your timestamp looks like it updated a touch early β that's the clock being extra, not a bug you get to file.
π₯ SEE ALSO π₯
the whole friend group, assembled. every single one, no gatekeeping π
- Kernel file
./kernel/time/timekeeping.c struct tk_fast(9)tk_setup_internals(9)update_fast_timekeeper(9)ktime_get_mono_fast_ns(9)ktime_get_raw_fast_ns(9)ktime_get_tai_fast_ns(9)ktime_get_real_fast_ns(9)halt_fast_timekeeper(9)pvclock_gtod_register_notifier(9)pvclock_gtod_unregister_notifier(9)timekeeping_forward_now(9)ktime_get_real_ts64(9)ktime_mono_to_any(9)ktime_get_raw(9)ktime_get_ts64(9)ktime_get_seconds(9)ktime_get_real_seconds(9)__ktime_get_real_seconds(9)ktime_get_snapshot_id(9)adjust_historical_crosststamp(9)ktime_real_to_base_clock(9)get_device_system_crosststamp(9)timekeeping_clocksource_has_base(9)do_settimeofday64(9)__timekeeping_inject_offset(9)timekeeping_notify(9)ktime_get_raw_ts64(9)timekeeping_valid_for_hres(9)timekeeping_max_deferment(9)read_persistent_clock64(9)read_persistent_wall_and_boot_offset(9)__timekeeping_inject_sleeptime(9)timekeeping_inject_sleeptime64(9)timekeeping_resume(9)update_wall_time(9)getboottime64(9)ktime_get_coarse_real_ts64_mg(9)ktime_get_real_ts64_mg(9)ktime_get_update_offsets_now(9)random_get_entropy_fallback(9)do_adjtimex(9)hardpps(9)ktime_get_aux(9)ktime_get_aux_ts64(9)
okay that's the whole page, you ate that π certified kernel girlie behavior, see you in the group chat β this one lives in ./kernel/time and dates back to October 2026, mwah πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms