aboutsummaryrefslogtreecommitdiff
path: root/x11-wm/niri/files/patch-smithay-i386
blob: 1abbea186ed05475c2f6a3c29e402630dddbcf9b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
https://github.com/Smithay/smithay/issues/1315

--- ../smithay-0eac415ba2d9409cbc201955dc0fd306c116ae05/src/utils/clock.rs.orig	2024-02-02 09:18:10 UTC
+++ ../smithay-0eac415ba2d9409cbc201955dc0fd306c116ae05/src/utils/clock.rs
@@ -119,8 +119,11 @@ impl<Kind: NonNegativeClockSource> From<Duration> for 
 impl<Kind: NonNegativeClockSource> From<Duration> for Time<Kind> {
     fn from(tp: Duration) -> Self {
         let tp = Timespec {
-            tv_sec: tp.as_secs() as std::os::raw::c_longlong,
-            tv_nsec: tp.subsec_nanos() as std::os::raw::c_longlong,
+            tv_sec: tp.as_secs() as libc::time_t,
+            #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+            tv_nsec: tp.subsec_nanos() as i64,
+            #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
+            tv_nsec: tp.subsec_nanos() as std::os::raw::c_long,
         };
         Time {
             tp,
@@ -138,7 +141,11 @@ impl<Kind> From<Timespec> for Time<Kind> {
     }
 }
 
-const NANOS_PER_SEC: std::os::raw::c_longlong = 1_000_000_000;
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+const NANOS_PER_SEC: i64 = 1_000_000_000;
+
+#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
+const NANOS_PER_SEC: std::os::raw::c_long = 1_000_000_000;
 
 fn saturating_sub_timespec(lhs: Timespec, rhs: Timespec) -> Option<Duration> {
     if let Some(mut secs) = lhs.tv_sec.checked_sub(rhs.tv_sec) {