Improve clocks

There's a flaky performance test that I wanted to fix (1). This led to a couple
changes.

1 - Add timestamp() and milliTimestamp() to datetime.zig. Reduce some code
    duplication and use better clock_ids where available

2 - Change Performance API to use milliTimestamp and store a u64 instead of a
    f64. While the spec says a float, Firefox deals with u64 and implicit
    conversion is always available. Makes our APIs simpler.

(1) - https://github.com/lightpanda-io/browser/actions/runs/17313296490/job/49151366798#step:4:131
This commit is contained in:
Karl Seguin
2025-08-30 13:36:02 +08:00
parent d02ba777f2
commit ada9ddd5b8
7 changed files with 61 additions and 45 deletions

View File

@@ -897,8 +897,7 @@ fn buildJSONVersionResponse(
}
fn timestamp() u32 {
const ts = std.posix.clock_gettime(std.posix.CLOCK.MONOTONIC) catch unreachable;
return @intCast(ts.sec);
return @import("datetime.zig").timestamp();
}
// In-place string lowercase