wrap call in unsafe, unconditionally depend on winapi

This commit is contained in:
Mark McCaskey
2019-05-21 10:41:40 -07:00
parent 736bddfe17
commit 2a30fc3f1b
4 changed files with 4 additions and 3 deletions

1
Cargo.lock generated
View File

@ -2492,6 +2492,7 @@ dependencies = [
"wasmer-dev-utils 0.4.2", "wasmer-dev-utils 0.4.2",
"wasmer-runtime-core 0.4.2", "wasmer-runtime-core 0.4.2",
"wasmer-singlepass-backend 0.4.2", "wasmer-singlepass-backend 0.4.2",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]

View File

@ -19,7 +19,7 @@ log = "0.4.6"
byteorder = "1.3.1" byteorder = "1.3.1"
# hack to get tests to work # hack to get tests to work
wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.4.2", optional = true } wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.4.2", optional = true }
winapi = { version = "0.3.7", optional = true } winapi = "0.3"
[build-dependencies] [build-dependencies]
glob = "0.2.11" glob = "0.2.11"

View File

@ -2,7 +2,7 @@
#[macro_use] #[macro_use]
extern crate log; extern crate log;
#[cfg(target = windows)] #[cfg(target = "windows")]
extern crate winapi; extern crate winapi;
#[macro_use] #[macro_use]

View File

@ -29,7 +29,7 @@ pub fn platform_clock_time_get(
) -> __wasi_errno_t { ) -> __wasi_errno_t {
let nanos = match clock_id { let nanos = match clock_id {
__WASI_CLOCK_MONOTONIC => { __WASI_CLOCK_MONOTONIC => {
let tick_ms = winapi::um::sysinfoapi::GetTickCount64(); let tick_ms = unsafe { winapi::um::sysinfoapi::GetTickCount64() };
tick_ms * 1_000_000 tick_ms * 1_000_000
} }
__WASI_CLOCK_REALTIME => { __WASI_CLOCK_REALTIME => {