You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm parsing a unix timestamp and formatting it for the current timezone. This involves calling replace_offset() then checked_add() :
let fmt = format_description!("[year]-[month]-[day] [hour]:[minute]:[second] [offset_hour sign:mandatory]:[offset_minute]");let offset_secs = Duration::new(offset.whole_seconds().try_into().unwrap(),0);OffsetDateTime::from_unix_timestamp(ts).unwrap().replace_offset(offset).checked_add(offset_secs).unwrap().format(&fmt).unwrap()
It would be nice and less error-prone to have a set_offset() function that covers both operations.
It would be even nicer to have a set_timezone() function as this code is not DST-aware (and my program is multithreaded at this stage), but I understand that this is a much larger ask (#380).
The text was updated successfully, but these errors were encountered:
I'm parsing a unix timestamp and formatting it for the current timezone. This involves calling
replace_offset()
thenchecked_add()
:It would be nice and less error-prone to have a
set_offset()
function that covers both operations.It would be even nicer to have a
set_timezone()
function as this code is not DST-aware (and my program is multithreaded at this stage), but I understand that this is a much larger ask (#380).The text was updated successfully, but these errors were encountered: