Skip to content

Commit

Permalink
Fix windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
bwoebi committed Jul 8, 2024
1 parent 2e750e5 commit ddb960d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sidecar/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ sendfd = { version = "0.4", features = ["tokio"] }
[target.'cfg(windows)'.dependencies]
winapi = { version = "=0.2.8" }
kernel32-sys = "0.2.2"
windows-sys = "0.52.0"

[target.'cfg(windows_seh_wrapper)'.dependencies]
microseh = "0.1.1"
Expand Down
5 changes: 2 additions & 3 deletions sidecar/src/shm_limiters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use std::io;
use std::marker::PhantomData;
use std::sync::atomic::{AtomicI32, AtomicI64, AtomicU32, AtomicU64, Ordering};
use std::sync::{Arc, RwLock};
use std::time::Duration;

pub trait Limiter {
fn inc(&self, limit: u32) -> bool;
Expand All @@ -31,10 +30,10 @@ impl<T> LimiterData<T> {
/// Returns nanosecons on Unix, milliseconds on Windows.
fn now() -> u64 {
#[cfg(windows)]
let now = windows_sys::Win32::System::SystemInformation::GetTickCount64();
let now = unsafe { windows_sys::Win32::System::SystemInformation::GetTickCount64() };
#[cfg(not(windows))]
let now =
Duration::from(nix::time::clock_gettime(nix::time::ClockId::CLOCK_MONOTONIC).unwrap())
std::time::Duration::from(nix::time::clock_gettime(nix::time::ClockId::CLOCK_MONOTONIC).unwrap())
.as_nanos() as u64;
now
}
Expand Down

0 comments on commit ddb960d

Please sign in to comment.