Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ls,date: rename chrono::Duration to chrono::TimeDelta #5970

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/uu/date/src/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// spell-checker:ignore (chrono) Datelike Timelike ; (format) DATEFILE MMDDhhmm ; (vars) datetime datetimes

use chrono::format::{Item, StrftimeItems};
use chrono::{DateTime, Duration, FixedOffset, Local, Offset, Utc};
use chrono::{DateTime, FixedOffset, Local, Offset, TimeDelta, Utc};
#[cfg(windows)]
use chrono::{Datelike, Timelike};
use clap::{crate_version, Arg, ArgAction, Command};
Expand Down Expand Up @@ -91,7 +91,7 @@ enum DateSource {
Now,
Custom(String),
File(PathBuf),
Human(Duration),
Human(TimeDelta),
}

enum Iso8601Format {
Expand Down
2 changes: 1 addition & 1 deletion src/uu/ls/src/ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2981,7 +2981,7 @@ 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::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 {
TimeStyle::FullIso => time.format("%Y-%m-%d %H:%M:%S.%f %z"),
Expand Down
Loading