You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
380 B
Zig
15 lines
380 B
Zig
const std = @import("std");
|
|
const builtin = @import("builtin");
|
|
|
|
pub const Timer = if (builtin.is_test) TestTimer else std.time.Timer;
|
|
|
|
/// TestTimer always reports the same fixed value.
|
|
pub const TestTimer = if (!builtin.is_test) @compileError("TestTimer is for tests only") else struct {
|
|
value: u64,
|
|
|
|
pub fn read(self: *Timer) u64 {
|
|
return self.value;
|
|
}
|
|
};
|
|
|