treesummaryrefslogcommitdiff
path: root/timer.zig
blob: 874aee39cc9e4175e8ee38f5b6151776417ddf4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
const std = @import("std");

pub fn main() !void {
    var timer = try std.time.Timer.start();
    while (true) {
        const ns = timer.read();
        const h = (ns / 1000000000 / 3600);
        const m = (ns / 1000000000 / 60) % 60;
        const s = (ns / 1000000000) % 60;
        const ms = (ns / 1000000) % 1000;
        std.debug.print("\r{:0>1}:{:0>2}:{:0>2}.{:0<3}", .{h, m, s, ms});
        std.Thread.sleep(10000000);
    }
}