mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-09-15 11:36:16 +00:00
ls: use chrono::TimeDelta::try_seconds instead of
deprecated chrono::TimeDelta::seconds
This commit is contained in:
parent
a1c14fb550
commit
c45c00eed4
1 changed files with 2 additions and 1 deletions
|
@ -2981,7 +2981,8 @@ fn display_date(metadata: &Metadata, config: &Config) -> String {
|
||||||
Some(time) => {
|
Some(time) => {
|
||||||
//Date is recent if from past 6 months
|
//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.
|
//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 {
|
match &config.time_style {
|
||||||
TimeStyle::FullIso => time.format("%Y-%m-%d %H:%M:%S.%f %z"),
|
TimeStyle::FullIso => time.format("%Y-%m-%d %H:%M:%S.%f %z"),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue