mirror of
https://github.com/uutils/coreutils
synced 2024-12-14 15:22:38 +00:00
Merge pull request #5970 from cakebaker/ls_date_rename_duration_to_time_delta
ls,date: rename `chrono::Duration` to `chrono::TimeDelta`
This commit is contained in:
commit
b4c8a1aee0
2 changed files with 3 additions and 3 deletions
|
@ -6,7 +6,7 @@
|
||||||
// spell-checker:ignore (chrono) Datelike Timelike ; (format) DATEFILE MMDDhhmm ; (vars) datetime datetimes
|
// spell-checker:ignore (chrono) Datelike Timelike ; (format) DATEFILE MMDDhhmm ; (vars) datetime datetimes
|
||||||
|
|
||||||
use chrono::format::{Item, StrftimeItems};
|
use chrono::format::{Item, StrftimeItems};
|
||||||
use chrono::{DateTime, Duration, FixedOffset, Local, Offset, Utc};
|
use chrono::{DateTime, FixedOffset, Local, Offset, TimeDelta, Utc};
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
use chrono::{Datelike, Timelike};
|
use chrono::{Datelike, Timelike};
|
||||||
use clap::{crate_version, Arg, ArgAction, Command};
|
use clap::{crate_version, Arg, ArgAction, Command};
|
||||||
|
@ -91,7 +91,7 @@ enum DateSource {
|
||||||
Now,
|
Now,
|
||||||
Custom(String),
|
Custom(String),
|
||||||
File(PathBuf),
|
File(PathBuf),
|
||||||
Human(Duration),
|
Human(TimeDelta),
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Iso8601Format {
|
enum Iso8601Format {
|
||||||
|
|
|
@ -2981,7 +2981,7 @@ 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::Duration::seconds(31_556_952 / 2) > chrono::Local::now();
|
let recent = time + chrono::TimeDelta::seconds(31_556_952 / 2) > 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…
Reference in a new issue