From de241a03f9bed9cef6b197f92e47b64a435a3871 Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Fri, 29 Mar 2019 11:43:32 -0700 Subject: [PATCH] fix linux impl bugs --- lib/wasi/src/syscalls/unix/linux.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/wasi/src/syscalls/unix/linux.rs b/lib/wasi/src/syscalls/unix/linux.rs index e68d470fa..80a079b9b 100644 --- a/lib/wasi/src/syscalls/unix/linux.rs +++ b/lib/wasi/src/syscalls/unix/linux.rs @@ -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