Skip to content

Commit ecf3e70

Browse files
committed
timekeeping: Provide adjtimex() for auxiliary clocks
The behaviour is close to clock_adtime(CLOCK_REALTIME) with the following differences: 1) ADJ_SETOFFSET adjusts the auxiliary clock offset 2) ADJ_TAI is not supported 3) Leap seconds are not supported 4) PPS is not supported Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: John Stultz <jstultz@google.com> Link: https://lore.kernel.org/all/20250625183758.317946543@linutronix.de
1 parent 4eca49d commit ecf3e70

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

kernel/time/timekeeping.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2875,10 +2875,26 @@ static int aux_clock_set(const clockid_t id, const struct timespec64 *tnew)
28752875
return 0;
28762876
}
28772877

2878+
static int aux_clock_adj(const clockid_t id, struct __kernel_timex *txc)
2879+
{
2880+
struct tk_data *aux_tkd = aux_get_tk_data(id);
2881+
struct adjtimex_result result = { };
2882+
2883+
if (!aux_tkd)
2884+
return -ENODEV;
2885+
2886+
/*
2887+
* @result is ignored for now as there are neither hrtimers nor a
2888+
* RTC related to auxiliary clocks for now.
2889+
*/
2890+
return __do_adjtimex(aux_tkd, txc, &result);
2891+
}
2892+
28782893
const struct k_clock clock_aux = {
28792894
.clock_getres = aux_get_res,
28802895
.clock_get_timespec = aux_get_timespec,
28812896
.clock_set = aux_clock_set,
2897+
.clock_adj = aux_clock_adj,
28822898
};
28832899

28842900
static __init void tk_aux_setup(void)

0 commit comments

Comments
 (0)