From 2c9b214a47fefd1e44f989e479b5afe17341200e Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Wed, 19 Mar 2025 08:56:44 +0800 Subject: [PATCH] improve detection of nanosecond support in `gix-fs` (#1896) --- gix-fs/tests/fs/snapshot.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gix-fs/tests/fs/snapshot.rs b/gix-fs/tests/fs/snapshot.rs index 40939dea15e..d7f4ae91c58 100644 --- a/gix-fs/tests/fs/snapshot.rs +++ b/gix-fs/tests/fs/snapshot.rs @@ -50,5 +50,8 @@ fn has_nanosecond_times(root: &Path) -> std::io::Result { std::fs::write(&test_file, "b")?; let second_time = test_file.metadata()?.modified()?; - Ok(first_time != second_time) + Ok(second_time.duration_since(first_time).is_ok_and(|d| + // This can be falsely false if a filesystem would be ridiculously fast, + // which means a test won't run even though it could. But that's OK, and unlikely. + d.subsec_nanos() != 0)) }