diff --git a/src/uucore/src/lib/features/utmpx.rs b/src/uucore/src/lib/features/utmpx.rs index bdc3544b2bc..e9d1bb28ac8 100644 --- a/src/uucore/src/lib/features/utmpx.rs +++ b/src/uucore/src/lib/features/utmpx.rs @@ -189,7 +189,8 @@ impl Utmpx { let ts_nanos: i128 = (1_000_000_000_i64 * self.inner.ut_tv.tv_sec as i64 + 1_000_i64 * self.inner.ut_tv.tv_usec as i64) .into(); - let local_offset = time::OffsetDateTime::now_local().unwrap().offset(); + let local_offset = + time::OffsetDateTime::now_local().map_or_else(|_| time::UtcOffset::UTC, |v| v.offset()); time::OffsetDateTime::from_unix_timestamp_nanos(ts_nanos) .unwrap() .to_offset(local_offset)