diff --git a/src/uu/du/Cargo.toml b/src/uu/du/Cargo.toml index b9285e5a8..a9f4786f9 100644 --- a/src/uu/du/Cargo.toml +++ b/src/uu/du/Cargo.toml @@ -21,7 +21,7 @@ path = "src/du.rs" # For the --exclude & --exclude-from options glob = { workspace = true } clap = { workspace = true } -uucore = { workspace = true, features = ["format", "parser", "time"] } +uucore = { workspace = true, features = ["format", "fsext", "parser", "time"] } thiserror = { workspace = true } [target.'cfg(target_os = "windows")'.dependencies] diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 01b115482..758d57600 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -7,24 +7,21 @@ use clap::{Arg, ArgAction, ArgMatches, Command, builder::PossibleValue}; use glob::Pattern; use std::collections::{HashMap, HashSet}; use std::env; -#[cfg(not(windows))] use std::fs::Metadata; use std::fs::{self, DirEntry, File}; use std::io::{BufRead, BufReader, stdout}; #[cfg(not(windows))] use std::os::unix::fs::MetadataExt; #[cfg(windows)] -use std::os::windows::fs::MetadataExt; -#[cfg(windows)] use std::os::windows::io::AsRawHandle; use std::path::{Path, PathBuf}; use std::str::FromStr; use std::sync::mpsc; use std::thread; -use std::time::{Duration, UNIX_EPOCH}; use thiserror::Error; use uucore::display::{Quotable, print_verbatim}; use uucore::error::{FromIo, UError, UResult, USimpleError, set_exit_code}; +use uucore::fsext::{MetadataTimeField, metadata_get_time}; use uucore::line_ending::LineEnding; use uucore::locale::{get_message, get_message_with_args}; use uucore::parser::parse_glob; @@ -87,7 +84,7 @@ struct StatPrinter { threshold: Option, apparent_size: bool, size_format: SizeFormat, - time: Option