Skip to content

Commit

Permalink
Draft: fix for musl 1.2.0 time_t change
Browse files Browse the repository at this point in the history
rust-lang/libc#1848

This is a work in progress to resolve the time_t definition change in
musl 1.2.0, where on 32 bit systems the definition has been changed from
32 bits to 64 bits.

Signed-off-by: Mislav Novakovic <[email protected]>
  • Loading branch information
mislavn committed Jun 7, 2024
1 parent 468ba0b commit 8f025e7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pnet_sys/src/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ pub mod public {
/// Convert a Duration into a platform specific `timeval`.
pub fn duration_to_timeval(dur: Duration) -> libc::timeval {
libc::timeval {
#[cfg_attr(target_env = "musl", allow(deprecated))] // FIXME: https://github.com/rust-lang/libc/issues/1848
tv_sec: dur.as_secs() as libc::time_t,
tv_usec: dur.subsec_micros() as TvUsecType,
}
Expand All @@ -118,6 +119,7 @@ pub mod public {
/// Convert a Duration into a platform specific `timespec`.
pub fn duration_to_timespec(dur: Duration) -> libc::timespec {
libc::timespec {
#[cfg_attr(target_env = "musl", allow(deprecated))] // FIXME: https://github.com/rust-lang/libc/issues/1848
tv_sec: dur.as_secs() as libc::time_t,
tv_nsec: (dur.subsec_nanos() as TvUsecType).into(),
}
Expand Down

0 comments on commit 8f025e7

Please sign in to comment.