zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 0f0d01a0374dd62d55a0fe3eed72b9ec009af410 (tree)
parent d27721f58cfeff5fcd805125875e9c55b54b65bd
Author: Benjamin Feng <contact@fengb.me>
Date:   Thu, 21 Nov 2019 18:41:02 -0600

Replace magic numbers with named constants

Diffstat:
Mlib/std/os/wasi.zig | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/std/os/wasi.zig b/lib/std/os/wasi.zig @@ -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; } @@ -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; }