commit ecb0cb661a75a130cf6978fa42d464e2d654d8df (tree)
parent 9ca94bbba55b523abe3544e87c1710a83064d29a
Author: Andrew Kelley <andrew@ziglang.org>
Date: Wed, 30 Jan 2019 02:53:59 -0500
darwin time code: don't cast to int until the end
See #1648
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/std/os/time.zig b/std/os/time.zig
@@ -84,9 +84,9 @@ fn milliTimestampDarwin() u64 {
var tv: darwin.timeval = undefined;
var err = darwin.gettimeofday(&tv, null);
debug.assert(err == 0);
- const sec_ms = @intCast(u64, tv.tv_sec) * ms_per_s;
- const usec_ms = @divFloor(@intCast(u64, tv.tv_usec), us_per_s / ms_per_s);
- return u64(sec_ms) + u64(usec_ms);
+ const sec_ms = tv.tv_sec * ms_per_s;
+ const usec_ms = @divFloor(tv.tv_usec, us_per_s / ms_per_s);
+ return @intCast(u64, sec_ms + usec_ms);
}
fn milliTimestampPosix() u64 {