Skip to content

Commit

Permalink
fix linux impl bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark McCaskey committed Mar 29, 2019
1 parent 48d34d9 commit de241a0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/wasi/src/syscalls/unix/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,17 @@ pub fn platform_clock_time_get(
_ => return __WASI_EINVAL,
};

let output = unsafe {
let (output, timespec_out) = unsafe {
let mut timespec_out: timespec = mem::uninitialized();
clock_gettime(linux_clock_id, precision, &mut timespec_out);
(
clock_gettime(linux_clock_id, &mut timespec_out),
timespec_out,
)
};

resolution.set(timespec_out.tv_nsec as __wasi_timestamp_t);
// TODO: adjust output by precision...

time.set(timespec_out.tv_nsec as __wasi_timestamp_t);

// TODO: map output of clock_gettime to __wasi_errno_t
__WASI_ESUCCESS
Expand Down

0 comments on commit de241a0

Please sign in to comment.