Skip to content

Commit 2c9b214

Browse files
committed
improve detection of nanosecond support in gix-fs (#1896)
1 parent 74ecdb8 commit 2c9b214

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

gix-fs/tests/fs/snapshot.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,8 @@ fn has_nanosecond_times(root: &Path) -> std::io::Result<bool> {
5050
std::fs::write(&test_file, "b")?;
5151
let second_time = test_file.metadata()?.modified()?;
5252

53-
Ok(first_time != second_time)
53+
Ok(second_time.duration_since(first_time).is_ok_and(|d|
54+
// This can be falsely false if a filesystem would be ridiculously fast,
55+
// which means a test won't run even though it could. But that's OK, and unlikely.
56+
d.subsec_nanos() != 0))
5457
}

0 commit comments

Comments
 (0)