mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-25 06:31:32 +00:00
fix WASI clock bugs
This commit is contained in:
@ -23,7 +23,8 @@ pub fn platform_clock_res_get(
|
||||
(clock_getres(unix_clock_id, &mut timespec_out), timespec_out)
|
||||
};
|
||||
|
||||
resolution.set(timespec_out.tv_nsec as __wasi_timestamp_t);
|
||||
let t_out = (timespec_out.tv_sec * 1_000_000_000).wrapping_add(timespec_out.tv_nsec);
|
||||
resolution.set(t_out as __wasi_timestamp_t);
|
||||
|
||||
// TODO: map output of clock_getres to __wasi_errno_t
|
||||
__WASI_ESUCCESS
|
||||
@ -50,9 +51,8 @@ pub fn platform_clock_time_get(
|
||||
)
|
||||
};
|
||||
|
||||
// TODO: adjust output by precision...
|
||||
|
||||
time.set(timespec_out.tv_nsec as __wasi_timestamp_t);
|
||||
let t_out = (timespec_out.tv_sec * 1_000_000_000).wrapping_add(timespec_out.tv_nsec);
|
||||
time.set(t_out as __wasi_timestamp_t);
|
||||
|
||||
// TODO: map output of clock_gettime to __wasi_errno_t
|
||||
__WASI_ESUCCESS
|
||||
|
Reference in New Issue
Block a user