14 lines
260 B
Zig
14 lines
260 B
Zig
// zig fmt: off
|
|
const std = @import("std");
|
|
const Clock = @This();
|
|
|
|
timestamp: i128 = 0,
|
|
|
|
pub fn sleep(self: *Clock, nanoseconds: u64) void {
|
|
self.timestamp += @intCast(nanoseconds);
|
|
}
|
|
|
|
pub fn nanoTimestamp(self: Clock) i128 {
|
|
return self.timestamp;
|
|
}
|