authorgravatar for contact@fengb.meBenjamin Feng <contact@fengb.me> 2019-11-21 18:41:02-06:00
committergravatar for contact@fengb.meBenjamin Feng <contact@fengb.me> 2019-11-21 18:41:02-06:00
log0f0d01a0374dd62d55a0fe3eed72b9ec009af410
tree54b69968d477eb51fae09756ab40d2773714b911
parentd27721f58cfeff5fcd805125875e9c55b54b65bd

Replace magic numbers with named constants


1 files changed, 4 insertions(+), 4 deletions(-)

lib/std/os/wasi.zig+4-4
...@@ -90,8 +90,8 @@ pub fn clock_getres(clock_id: i32, res: *timespec) errno_t {...@@ -90,8 +90,8 @@ pub fn clock_getres(clock_id: i32, res: *timespec) errno_t {
90 return err;90 return err;
91 }91 }
92 res.* = .{92 res.* = .{
93 .tv_sec = @intCast(i64, ts / 1000000000),93 .tv_sec = @intCast(i64, ts / std.time.ns_per_s),
94 .tv_nsec = @intCast(isize, ts % 1000000000),94 .tv_nsec = @intCast(isize, ts % std.time.ns_per_s),
95 };95 };
96 return 0;96 return 0;
97}97}
...@@ -103,8 +103,8 @@ pub fn clock_gettime(clock_id: i32, tp: *timespec) errno_t {...@@ -103,8 +103,8 @@ pub fn clock_gettime(clock_id: i32, tp: *timespec) errno_t {
103 return err;103 return err;
104 }104 }
105 tp.* = .{105 tp.* = .{
106 .tv_sec = @intCast(i64, ts / 1000000000),106 .tv_sec = @intCast(i64, ts / std.time.ns_per_s),
107 .tv_nsec = @intCast(isize, ts % 1000000000),107 .tv_nsec = @intCast(isize, ts % std.time.ns_per_s),
108 };108 };
109 return 0;109 return 0;
110}110}