From 4d59425948efaa3345adb02730d084dc83d559d2 Mon Sep 17 00:00:00 2001 From: dyknon Date: Mon, 24 Feb 2025 21:13:53 +0900 Subject: 32bit arch compat + binary w/o gui. --- src/v4l2.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/v4l2.rs') diff --git a/src/v4l2.rs b/src/v4l2.rs index a8aff0c..59b7ab4 100644 --- a/src/v4l2.rs +++ b/src/v4l2.rs @@ -178,23 +178,23 @@ impl BufAttrs{ buf.assume_init() }; let now_wallclock = Local::now(); - let mut timestamp = c::timespec{ - tv_sec: self.timestamp.tv_sec as _, - tv_nsec: self.timestamp.tv_usec as _, - }; - timestamp.tv_nsec *= 1000; + let timestamp_sec = self.timestamp.tv_sec as c::time_t; + #[allow(unused_assignments)] // it is used to copy type... + let mut timestamp_nsec = now_monotonic.tv_nsec; + timestamp_nsec = self.timestamp.tv_usec as _; + timestamp_nsec *= 1000; let (mut so, mut nso, future); - if now_monotonic.tv_sec < timestamp.tv_sec - || now_monotonic.tv_sec == timestamp.tv_sec - && now_monotonic.tv_nsec < timestamp.tv_nsec + if now_monotonic.tv_sec < timestamp_sec + || now_monotonic.tv_sec == timestamp_sec + && now_monotonic.tv_nsec < timestamp_nsec { future = true; - so = timestamp.tv_sec - now_monotonic.tv_sec; - nso = timestamp.tv_nsec - now_monotonic.tv_nsec; + so = timestamp_sec - now_monotonic.tv_sec; + nso = timestamp_nsec - now_monotonic.tv_nsec; }else{ future = false; - so = now_monotonic.tv_sec - timestamp.tv_sec; - nso = now_monotonic.tv_nsec - timestamp.tv_nsec; + so = now_monotonic.tv_sec - timestamp_sec; + nso = now_monotonic.tv_nsec - timestamp_nsec; } if nso < 0{ nso += 1000_000_000; @@ -221,8 +221,8 @@ impl Debug for BufAttrs{ .field("flags", &self.flags) .field("field", &self.field) .field("timestamp", &timeval{ - tv_sec: self.timestamp.tv_sec, - tv_usec: self.timestamp.tv_usec, + tv_sec: self.timestamp.tv_sec as _, + tv_usec: self.timestamp.tv_usec as _, }) .field("sequence", &self.sequence) .finish() -- cgit v1.2.3