]> gitweb.ps.run Git - onefile/blob - timer.zig
add timer.zig
[onefile] / timer.zig
1 const std = @import("std");
2
3 pub fn main() !void {
4     var timer = try std.time.Timer.start();
5     while (true) {
6         const ns = timer.read();
7         const h = (ns / 1000000000 / 3600);
8         const m = (ns / 1000000000 / 60) % 60;
9         const s = (ns / 1000000000) % 60;
10         const ms = (ns / 1000000) % 1000;
11         std.debug.print("\r{:0>1}:{:0>2}:{:0>2}.{:0<3}", .{h, m, s, ms});
12         std.Thread.sleep(10000000);
13     }
14 }