Skip to content

Commit d5beecb

Browse files
committed
correct factual mistake in Windows message, and use "+" sugar
1 parent 82d46b4 commit d5beecb

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/shims/time.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
100100
let NANOS_PER_INTERVAL = NANOS_PER_SEC / INTERVALS_PER_SEC;
101101
let SECONDS_TO_UNIX_EPOCH = INTERVALS_TO_UNIX_EPOCH / INTERVALS_PER_SEC;
102102

103-
let duration = system_time_to_duration(&SystemTime::now())?
104-
.checked_add(Duration::from_secs(SECONDS_TO_UNIX_EPOCH))
105-
.unwrap();
103+
let duration = system_time_to_duration(&SystemTime::now())? + Duration::from_secs(SECONDS_TO_UNIX_EPOCH);
106104
let duration_ticks = u64::try_from(duration.as_nanos() / u128::from(NANOS_PER_INTERVAL))
107-
.map_err(|_| err_unsup_format!("programs running longer than 2^64 ticks are not supported"))?;
105+
.map_err(|_| err_unsup_format!("programs running more than 2^64 Windows ticks after the Windows epoch are not supported"))?;
108106

109107
let dwLowDateTime = u32::try_from(duration_ticks & 0x00000000FFFFFFFF).unwrap();
110108
let dwHighDateTime = u32::try_from((duration_ticks & 0xFFFFFFFF00000000) >> 32).unwrap();

0 commit comments

Comments
 (0)