refactor: time -> clock

This commit is contained in:
Loïc Grégoire
2026-04-18 14:07:42 -04:00
parent a1db75746a
commit 44cf08e57c
13 changed files with 95 additions and 83 deletions
+4 -4
View File
@@ -75,7 +75,7 @@ pub fn set(timer: *Timer, time: r.Nanoseconds, dpc: ?*ke.Dpc) void {
defer cpu.lock.release_no_ipl();
// Initialize the timer.
timer.deadline = ke.time.read_time_nano() + time;
timer.deadline = ke.clock.read_time() + time;
timer.cpu = cpu;
timer.dpc = dpc;
@@ -134,7 +134,7 @@ pub fn clock() void {
ke.dpc.enqueue(&percpu.local().dpc, null);
// Check for overflows.
// This is fine to call a lot, as the function only gets expensive (i.e seqlock store) when an overflow actually happens.
ki.time.update_overflow();
ki.clock.update_overflow();
}
// Called in a DPC when a timer has expired.
@@ -143,7 +143,7 @@ fn handle_expiry(_: ?*anyopaque) void {
const cpu = percpu.local();
while (true) {
const curtime = ke.time.read_time_nano();
const curtime = ke.clock.read_time();
cpu.lock.acquire_no_ipl();
@@ -162,7 +162,7 @@ fn handle_expiry(_: ?*anyopaque) void {
cpu.lock.release_no_ipl();
// Re-check in case the timer expired while we were here.
const now = ke.time.read_time_nano();
const now = ke.clock.read_time();
if (next.deadline <= now or next.deadline - now <= std.time.ns_per_ms) {
continue; // expired in the meantime, loop again
}