mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
to_local: manage the error
This commit is contained in:
@@ -43,8 +43,13 @@ pub mod options {
|
||||
static ARG_FILES: &str = "files";
|
||||
|
||||
fn to_local(tm: time::PrimitiveDateTime) -> time::OffsetDateTime {
|
||||
// TODO: handle error getting now
|
||||
tm.assume_offset(time::OffsetDateTime::now_local().unwrap().offset())
|
||||
let offset = match time::OffsetDateTime::now_local() {
|
||||
Ok(lo) => lo.offset(),
|
||||
Err(e) => {
|
||||
panic!("error: {}", e);
|
||||
}
|
||||
};
|
||||
tm.assume_offset(offset)
|
||||
}
|
||||
|
||||
fn local_dt_to_filetime(dt: time::OffsetDateTime) -> FileTime {
|
||||
|
||||
Reference in New Issue
Block a user