Skip to content

Commit 4955ce3

Browse files
committed
Auto merge of #1297 - RalfJung:win-ticks, r=RalfJung
correct factual mistake in Windows message Also use `+` instead of `checked_add().unwrap()` (which is equivalent). Cc @JOE1994
2 parents 82d46b4 + d5beecb commit 4955ce3

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/shims/time.rs

+2-4
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)