all: type-safe time units

This commit is contained in:
Loïc Grégoire
2026-08-02 00:02:44 -04:00
parent 24372a2b4e
commit e36416304b
23 changed files with 137 additions and 61 deletions
+2 -2
View File
@@ -32,7 +32,7 @@ fn plot_pixel(x: i64, y: i64, color: u32) void {
}
fn rand_tsc_based() u32 {
const tsc = ke.time.read_time();
const tsc = ke.time.read_time().value;
const lo: u32 = @truncate(tsc);
const hi: u32 = @truncate(tsc >> 32);
return lo ^ hi;
@@ -100,7 +100,7 @@ fn get_random_color() u32 {
fn perform_delay(ms: usize) void {
var timer: ke.Timer = undefined;
timer.init();
ke.timer.set(&timer, std.time.ns_per_ms * ms, .{});
ke.timer.set(&timer, .init(std.time.ns_per_ms * ms), .{});
_ = ke.wait.wait_one(&timer.hdr, "sleep", .{}) catch unreachable;
}