ktime_get_seconds(9)
π ktime_get_seconds β the manual page, but make it a group chat
okay so bestie, welcome to the kernel API manual for ktime_get_seconds(9) πΈ this one's a little legend and honestly kind of a comfort function. let's get into it.
β¨ NAME β¨
ktime_get_seconds β get the seconds portion of CLOCK_MONOTONIC β° no cap, that's the whole personality.
π SYNOPSIS π
time64_t ktime_get_seconds (void );
that's it. that's the whole call. she takes nothing and gives you a time64_t. icon behavior fr fr π
π¦ ARGUMENTS π¦
voidβ no arguments. zero. none. she doesn't need anything from you, she's lowkey self-sufficient like that π
π₯ DESCRIPTION π₯
So what does she actually do? She returns the seconds portion of CLOCK_MONOTONIC β with a single non serialized read. like, one read, no locking drama, no queue, just vibes and a timestamp π«Ά
The way this works is tk->ktime_sec is of type unsigned long, which is the real MVP here because it means this works on both 32 and 64 bit systems β¨ highkey elegant.
And on 32 bit systems? the readout covers ~136 years of uptime β which, bestie, should be enough to prevent premature wrap arounds π like genuinely who's gonna be running that box in 136 years. she thought ahead. main character energy.
π SEE ALSO π
okay this is the part where the kernel flexes her whole friend group π literally everyone shows up to this party, and honestly? obsessed. here's the full guest list (all from the kernel file ./kernel/time/timekeeping.c, tyvm):
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_boot_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_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)
go read them all, iykyk π§β¨
bestie note: the readout here covers ~136 years on 32 bit β that's the premature wrap-around protection, so like... don't stress about it, but also know the limit exists. periodt π
and that's the whole page! π brought to you by the kernel file ./kernel/time, dated October 2026, and signed off as ktime_get_seconds(9) β stay monotonic, bestie, 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