Skip to content

Commit

Permalink
Replace magic numbers with named constants
Browse files Browse the repository at this point in the history
  • Loading branch information
fengb committed Nov 22, 2019
1 parent d27721f commit 0f0d01a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/std/os/wasi.zig
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ pub fn clock_getres(clock_id: i32, res: *timespec) errno_t {
return err;
}
res.* = .{
.tv_sec = @intCast(i64, ts / 1000000000),
.tv_nsec = @intCast(isize, ts % 1000000000),
.tv_sec = @intCast(i64, ts / std.time.ns_per_s),
.tv_nsec = @intCast(isize, ts % std.time.ns_per_s),
};
return 0;
}
Expand All @@ -103,8 +103,8 @@ pub fn clock_gettime(clock_id: i32, tp: *timespec) errno_t {
return err;
}
tp.* = .{
.tv_sec = @intCast(i64, ts / 1000000000),
.tv_nsec = @intCast(isize, ts % 1000000000),
.tv_sec = @intCast(i64, ts / std.time.ns_per_s),
.tv_nsec = @intCast(isize, ts % std.time.ns_per_s),
};
return 0;
}
Expand Down

0 comments on commit 0f0d01a

Please sign in to comment.