From ff76c01ac78f3113e5fb3a76a9b645121a5c688c Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Tue, 28 Jul 2026 19:57:26 +0800 Subject: [PATCH] fix(ci): pick mtime nanoseconds a Windows SystemTime can hold A Windows `SystemTime` is a FILETIME, whose tick is 100ns, so `UNIX_EPOCH + Duration::new(_, 123_456_789)` came back as `123_456_700` and the assertion failed on a rounding this conversion never saw. Every nanosecond figure in the case is now a multiple of 100, which still exercises the full nanos field. --- crates/tty7-core/src/host/mod.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/tty7-core/src/host/mod.rs b/crates/tty7-core/src/host/mod.rs index f3c3388f..35c99f09 100644 --- a/crates/tty7-core/src/host/mod.rs +++ b/crates/tty7-core/src/host/mod.rs @@ -600,15 +600,20 @@ mod tests { /// Pre-epoch times round-trip exactly rather than clamping to zero, because /// the editor compares mtimes for equality. + /// + /// Every nanosecond figure here is a multiple of 100: a Windows + /// `SystemTime` is a FILETIME, whose tick *is* 100ns, so a finer value + /// would be rounded on the way in and the assertion would be about + /// `SystemTime`'s resolution rather than about this conversion. #[test] fn mtime_handles_both_sides_of_the_epoch() { use std::time::{Duration, UNIX_EPOCH}; - let t = UNIX_EPOCH + Duration::new(1_700_000_000, 123_456_789); + let t = UNIX_EPOCH + Duration::new(1_700_000_000, 123_456_700); assert_eq!( MTime::from_system_time(t), MTime { secs: 1_700_000_000, - nanos: 123_456_789 + nanos: 123_456_700 } ); assert_eq!(