Fix compile errors for MacOS

This commit is contained in:
LeRoyce Pearson 2020-05-01 09:08:32 -06:00 committed by Andrew Kelley
parent 2dfe798217
commit b85a191398

View File

@ -74,10 +74,9 @@ pub fn _init_timestart() void {
var micro: os.darwin.timeval = undefined;
var timestart: DarwinTimeStart = undefined;
var err = os.darwin.mach_timebase_info(&timestart.timebase);
assert(err == 0);
os.darwin.mach_timebase_info(&timestart.timebase);
err = os.darwin.gettimeofday(&micro, null);
const err = os.darwin.gettimeofday(&micro, null);
assert(err == 0);
timestart.initclock = os.darwin.mach_absolute_time();
@ -119,7 +118,7 @@ pub fn nanoTimestamp() u64 {
_init_timestart_once.call();
const clock: u64 = os.darwin.mach_absolute_time() - _timestart.initclock;
const nano = clock * @divFloor(@as(u64, _timestart.timebase.number), @as(u64, _timestart.timebase.denom));
const nano = @divFloor(clock * @as(u64, _timestart.timebase.numer), @as(u64, _timestart.timebase.denom));
const tv_sec_nsec = @intCast(u64, _timestart.inittime.tv_sec) * ns_per_s;
const tv_nsec = @intCast(u64, _timestart.inittime.tv_nsec);