1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-15 03:26:18 +00:00

ls: use chrono::TimeDelta::try_seconds instead of

deprecated chrono::TimeDelta::seconds
This commit is contained in:
Daniel Hofstetter 2024-03-06 17:51:19 +01:00
parent a1c14fb550
commit c45c00eed4

View file

@ -2981,7 +2981,8 @@ fn display_date(metadata: &Metadata, config: &Config) -> String {
Some(time) => {
//Date is recent if from past 6 months
//According to GNU a Gregorian year has 365.2425 * 24 * 60 * 60 == 31556952 seconds on the average.
let recent = time + chrono::TimeDelta::seconds(31_556_952 / 2) > chrono::Local::now();
let recent = time + chrono::TimeDelta::try_seconds(31_556_952 / 2).unwrap()
> chrono::Local::now();
match &config.time_style {
TimeStyle::FullIso => time.format("%Y-%m-%d %H:%M:%S.%f %z"),