mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +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";
|
static ARG_FILES: &str = "files";
|
||||||
|
|
||||||
fn to_local(tm: time::PrimitiveDateTime) -> time::OffsetDateTime {
|
fn to_local(tm: time::PrimitiveDateTime) -> time::OffsetDateTime {
|
||||||
// TODO: handle error getting now
|
let offset = match time::OffsetDateTime::now_local() {
|
||||||
tm.assume_offset(time::OffsetDateTime::now_local().unwrap().offset())
|
Ok(lo) => lo.offset(),
|
||||||
|
Err(e) => {
|
||||||
|
panic!("error: {}", e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
tm.assume_offset(offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn local_dt_to_filetime(dt: time::OffsetDateTime) -> FileTime {
|
fn local_dt_to_filetime(dt: time::OffsetDateTime) -> FileTime {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue