diff --git a/Cargo.lock b/Cargo.lock index 4e2996c83..833f11516 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -508,7 +508,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" dependencies = [ "lazy_static", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -1074,7 +1074,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -1667,7 +1667,7 @@ dependencies = [ "portable-atomic", "portable-atomic-util", "serde", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -4127,6 +4127,7 @@ dependencies = [ "clap", "filetime", "fluent", + "jiff", "parse_datetime", "thiserror 2.0.17", "uucore", diff --git a/src/uu/touch/Cargo.toml b/src/uu/touch/Cargo.toml index 55ac39bd8..f5409ec7a 100644 --- a/src/uu/touch/Cargo.toml +++ b/src/uu/touch/Cargo.toml @@ -22,6 +22,7 @@ path = "src/touch.rs" filetime = { workspace = true } clap = { workspace = true } chrono = { workspace = true } +jiff = "0.2.15" parse_datetime = { workspace = true } thiserror = { workspace = true } uucore = { workspace = true, features = ["libc", "parser"] } diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index 7f7464094..b1581f8f0 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -15,6 +15,7 @@ use chrono::{ use clap::builder::{PossibleValue, ValueParser}; use clap::{Arg, ArgAction, ArgGroup, ArgMatches, Command}; use filetime::{FileTime, set_file_times, set_symlink_file_times}; +use jiff::{Timestamp, Zoned}; use std::borrow::Cow; use std::ffi::OsString; use std::fs::{self, File}; @@ -588,7 +589,7 @@ fn stat(path: &Path, follow: bool) -> std::io::Result<(FileTime, FileTime)> { )) } -fn parse_date(_ref_time: DateTime, s: &str) -> Result { +fn parse_date(ref_time: DateTime, s: &str) -> Result { // This isn't actually compatible with GNU touch, but there doesn't seem to // be any simple specification for what format this parameter allows and I'm // not about to implement GNU parse_datetime. @@ -638,14 +639,35 @@ fn parse_date(_ref_time: DateTime, s: &str) -> Result