Replace set_modified() with manual impl
Browse files at this commitb3d2096439f194108bd11c56fbf0ecb1a7a73fdfParent: 94ded2f1 changed file +28 -3
- src/watcher.rs +28 -3
src/watcher.rsmodified+28 -3
| @@ -91,10 +91,11 @@ mod tests { | ||
| 91 | 91 | use std::fs::File; |
| 92 | 92 | use std::io::Write; |
| 93 | 93 | use std::sync::atomic::AtomicU8; |
| 94 | - use std::time::SystemTime; | |
| 95 | 94 | |
| 96 | 95 | use calloop::channel::sync_channel; |
| 97 | 96 | use calloop::EventLoop; |
| 97 | + use smithay::reexports::rustix::fs::{futimens, Timestamps}; | |
| 98 | + use smithay::reexports::rustix::time::Timespec; | |
| 98 | 99 | use xshell::{cmd, Shell}; |
| 99 | 100 | |
| 100 | 101 | use super::*; |
| @@ -280,7 +281,19 @@ mod tests { | ||
| 280 | 281 | let mut c2 = File::create(d2).unwrap(); |
| 281 | 282 | write!(c2, "a")?; |
| 282 | 283 | c2.flush()?; |
| 283 | - c2.set_modified(SystemTime::UNIX_EPOCH)?; | |
| 284 | + futimens( | |
| 285 | + &c2, | |
| 286 | + &Timestamps { | |
| 287 | + last_access: Timespec { | |
| 288 | + tv_sec: 0, | |
| 289 | + tv_nsec: 0, | |
| 290 | + }, | |
| 291 | + last_modification: Timespec { | |
| 292 | + tv_sec: 0, | |
| 293 | + tv_nsec: 0, | |
| 294 | + }, | |
| 295 | + }, | |
| 296 | + )?; | |
| 284 | 297 | c2.sync_all()?; |
| 285 | 298 | drop(c2); |
| 286 | 299 | |
| @@ -289,7 +302,19 @@ mod tests { | ||
| 289 | 302 | let mut c3 = File::create(d3).unwrap(); |
| 290 | 303 | write!(c3, "b")?; |
| 291 | 304 | c3.flush()?; |
| 292 | - c3.set_modified(SystemTime::UNIX_EPOCH)?; | |
| 305 | + futimens( | |
| 306 | + &c3, | |
| 307 | + &Timestamps { | |
| 308 | + last_access: Timespec { | |
| 309 | + tv_sec: 0, | |
| 310 | + tv_nsec: 0, | |
| 311 | + }, | |
| 312 | + last_modification: Timespec { | |
| 313 | + tv_sec: 0, | |
| 314 | + tv_nsec: 0, | |
| 315 | + }, | |
| 316 | + }, | |
| 317 | + )?; | |
| 293 | 318 | c3.sync_all()?; |
| 294 | 319 | drop(c3); |
| 295 | 320 |