Skip to content

Commit a883d54

Browse files
committed
Fixing timespec's tv_nsec for macos. Borrowing from libc
1 parent 444b315 commit a883d54

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/unix/utimes.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ fn to_timeval(ft: &FileTime) -> libc::timeval {
121121
fn to_timespec(ft: &FileTime) -> libc::timespec {
122122
libc::timespec {
123123
tv_sec: ft.seconds() as libc::time_t,
124-
tv_nsec: (ft.nanoseconds()) as libc::suseconds_t,
124+
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
125+
tv_nsec: (ft.nanoseconds()) as i64,
126+
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
127+
tv_nsec: (ft.nanoseconds()) as libc::c_long
125128
}
126129
}

0 commit comments

Comments
 (0)