Skip to content

Commit 11639d6

Browse files
committed
Fall back to Tz::UTC
1 parent 727aa04 commit 11639d6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/shims/time.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
142142
// Figure out what time zone is in use
143143
let tz = this.get_var(OsStr::new("TZ"))?.unwrap_or_else(|| OsString::from("UTC"));
144144
let tz = match tz.into_string() {
145-
Ok(tz) => Tz::from_str(&tz).unwrap_or(Tz::Zulu),
146-
_ => Tz::Zulu,
145+
Ok(tz) => Tz::from_str(&tz).unwrap_or(Tz::UTC),
146+
_ => Tz::UTC,
147147
};
148148

149149
// Convert that to local time, then return the broken-down time value.
@@ -156,7 +156,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
156156

157157
// tm_zone represents the timezone value in the form of: +0730, +08, -0730 or -08.
158158
// This may not be consistent with libc::localtime_r's result.
159-
let offset_in_seconds = Utc::now().with_timezone(&tz).offset().fix().local_minus_utc();
159+
let offset_in_seconds = dt.offset().fix().local_minus_utc();
160160
let tm_gmtoff = offset_in_seconds;
161161
let mut tm_zone = String::new();
162162
if offset_in_seconds < 0 {

0 commit comments

Comments
 (0)