darwin time code: don't cast to int until the end

See #1648
master
Andrew Kelley 2019-01-30 02:53:59 -05:00
parent 9ca94bbba5
commit ecb0cb661a
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
1 changed files with 3 additions and 3 deletions

View File

@ -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 {