mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-13 06:15:33 +00:00
debug log error in windows clock, conditionally pull in winapi
This commit is contained in:
parent
08b4b639f4
commit
736bddfe17
@ -2,6 +2,8 @@
|
||||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
#[cfg(target = windows)]
|
||||
extern crate winapi;
|
||||
|
||||
#[macro_use]
|
||||
mod macros;
|
||||
|
@ -5,7 +5,7 @@ pub fn platform_clock_res_get(
|
||||
clock_id: __wasi_clockid_t,
|
||||
resolution: &Cell<__wasi_timestamp_t>,
|
||||
) -> __wasi_errno_t {
|
||||
let resolution = match clock_id {
|
||||
let resolution_val = match clock_id {
|
||||
// resolution of monotonic clock at 10ms, from:
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-gettickcount64
|
||||
__WASI_CLOCK_MONOTONIC => 10_000_000,
|
||||
@ -18,7 +18,7 @@ pub fn platform_clock_res_get(
|
||||
return __WASI_EINVAL;
|
||||
}
|
||||
};
|
||||
resolution.set(resolution);
|
||||
resolution.set(resolution_val);
|
||||
__WASI_ESUCCESS
|
||||
}
|
||||
|
||||
@ -35,7 +35,10 @@ pub fn platform_clock_time_get(
|
||||
__WASI_CLOCK_REALTIME => {
|
||||
let duration = wasi_try!(std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.ok_or(__WASI_EIO));
|
||||
.map_err(|e| {
|
||||
debug!("Error in wasi::platform_clock_time_get: {:?}", e);
|
||||
__WASI_EIO
|
||||
}));
|
||||
duration.as_nanos() as u64
|
||||
}
|
||||
__WASI_CLOCK_PROCESS_CPUTIME_ID => {
|
||||
|
Loading…
Reference in New Issue
Block a user