1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

Merge pull request #6414 from cakebaker/pinky_fix_idle_string

pinky: use UTC if offset can't be determined
This commit is contained in:
Sylvestre Ledru 2024-05-19 21:53:46 +02:00 committed by GitHub
commit f013d230f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -115,7 +115,7 @@ struct Pinky {
fn idle_string(when: i64) -> String {
thread_local! {
static NOW: time::OffsetDateTime = time::OffsetDateTime::now_local().unwrap();
static NOW: time::OffsetDateTime = time::OffsetDateTime::now_local().unwrap_or_else(|_| time::OffsetDateTime::now_utc());
}
NOW.with(|n| {
let duration = n.unix_timestamp() - when;