mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-08 20:45:29 +00:00
fix deprecation warning
This commit is contained in:
parent
f2241a96f9
commit
40b0b7b364
@ -13,6 +13,7 @@ use std::{
|
|||||||
use filetime::{set_file_mtime, FileTime};
|
use filetime::{set_file_mtime, FileTime};
|
||||||
use fs_err as fs;
|
use fs_err as fs;
|
||||||
use same_file::Handle;
|
use same_file::Handle;
|
||||||
|
use time::OffsetDateTime;
|
||||||
use ubyte::ToByteUnit;
|
use ubyte::ToByteUnit;
|
||||||
use zip::{self, read::ZipFile, DateTime, ZipArchive};
|
use zip::{self, read::ZipFile, DateTime, ZipArchive};
|
||||||
|
|
||||||
@ -257,8 +258,8 @@ fn display_zip_comment_if_exists(file: &ZipFile) {
|
|||||||
fn get_last_modified_time(file: &fs::File) -> DateTime {
|
fn get_last_modified_time(file: &fs::File) -> DateTime {
|
||||||
file.metadata()
|
file.metadata()
|
||||||
.and_then(|metadata| metadata.modified())
|
.and_then(|metadata| metadata.modified())
|
||||||
.map_err(|_| ())
|
.ok()
|
||||||
.and_then(|time| DateTime::from_time(time.into()))
|
.and_then(|time| DateTime::try_from(OffsetDateTime::from(time)).ok())
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user