mirror of
https://github.com/uutils/coreutils
synced 2024-11-16 09:48:03 +00:00
to_local: manage the error
This commit is contained in:
parent
e70b99dad0
commit
65d0f5ba9f
1 changed files with 7 additions and 2 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue