From ff992765949d4486085f71951d3b2ae940a9be3d Mon Sep 17 00:00:00 2001 From: wtcpython <1762993226@qq.com> Date: Fri, 25 Sep 2026 20:00:36 +0800 Subject: [PATCH] deps: migrate from chrono to jiff --- Cargo.lock | 107 +----------------------------------- Cargo.toml | 2 +- src/find/matchers/group.rs | 3 +- src/find/matchers/ls.rs | 24 ++++---- src/find/matchers/mod.rs | 48 +++++++++------- src/find/matchers/printf.rs | 63 +++++++++------------ src/find/matchers/time.rs | 26 ++++----- src/find/matchers/user.rs | 3 +- src/locate/mod.rs | 64 +++++++++++---------- 9 files changed, 115 insertions(+), 225 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ceef2529..5ae5a8f8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11,15 +11,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - [[package]] name = "anes" version = "0.1.6" @@ -191,19 +182,6 @@ dependencies = [ "rand_core", ] -[[package]] -name = "chrono" -version = "0.4.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" -dependencies = [ - "iana-time-zone", - "js-sys", - "num-traits", - "wasm-bindgen", - "windows-link", -] - [[package]] name = "ciborium" version = "0.2.2" @@ -333,12 +311,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - [[package]] name = "cpufeatures" version = "0.3.0" @@ -538,13 +510,13 @@ version = "0.11.0" dependencies = [ "argmax", "assert_cmd", - "chrono", "clap", "codspeed-criterion-compat", "ctor", "faccess", "filetime", "itertools 0.15.0", + "jiff", "nix 0.31.3", "onig", "regex", @@ -684,30 +656,6 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" -[[package]] -name = "iana-time-zone" -version = "0.1.65" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "log", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - [[package]] name = "indexmap" version = "2.14.0" @@ -1738,65 +1686,12 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows-core" -version = "0.62.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" -dependencies = [ - "windows-implement", - "windows-interface", - "windows-link", - "windows-result", - "windows-strings", -] - -[[package]] -name = "windows-implement" -version = "0.60.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "windows-interface" -version = "0.59.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - [[package]] name = "windows-link" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" -[[package]] -name = "windows-result" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" -dependencies = [ - "windows-link", -] - -[[package]] -name = "windows-strings" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" -dependencies = [ - "windows-link", -] - [[package]] name = "windows-sys" version = "0.59.0" diff --git a/Cargo.toml b/Cargo.toml index dd4992b7..f7c5b52e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ pkg-fmt = "zip" [dependencies] argmax = "0.4.0" -chrono = "0.4.45" +jiff = "0.2" clap = { version = "4.6", features = ["env"] } faccess = "0.2.4" nix = { version = "0.31", features = ["fs", "user"] } diff --git a/src/find/matchers/group.rs b/src/find/matchers/group.rs index 7b35c86c..f750bfb5 100644 --- a/src/find/matchers/group.rs +++ b/src/find/matchers/group.rs @@ -95,7 +95,6 @@ mod tests { fn test_group_matcher() { use crate::find::matchers::{group::GroupMatcher, tests::get_dir_entry_for, Matcher}; use crate::find::tests::FakeDependencies; - use chrono::Local; use nix::unistd::{Gid, Group}; use std::fs::File; use std::os::unix::fs::MetadataExt; @@ -122,7 +121,7 @@ mod tests { ); // Testing a non-existent group name - let time_string = Local::now().format("%Y%m%d%H%M%S").to_string(); + let time_string = jiff::Zoned::now().strftime("%Y%m%d%H%M%S").to_string(); let matcher = GroupMatcher::from_group_name(time_string.as_str()); assert!( matcher.is_none(), diff --git a/src/find/matchers/ls.rs b/src/find/matchers/ls.rs index 9b05f82d..246dcf66 100644 --- a/src/find/matchers/ls.rs +++ b/src/find/matchers/ls.rs @@ -2,8 +2,6 @@ // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. - -use chrono::DateTime; use std::{ fs::File, io::{stderr, Write}, @@ -157,11 +155,12 @@ impl Ls { let group = uucore::entries::gid2grp(metadata.gid()).unwrap_or_else(|_| metadata.gid().to_string()); let size = metadata.size(); - let last_modified = { - let system_time = metadata.modified().unwrap(); - let now_utc: DateTime = system_time.into(); - now_utc.format("%b %e %H:%M") - }; + let last_modified = metadata + .modified() + .ok() + .and_then(|t| jiff::Timestamp::try_from(t).ok()) + .map(|ts| ts.strftime("%b %e %H:%M").to_string()) + .unwrap_or_default(); let path = file_info.path().to_string_lossy(); match writeln!( @@ -230,11 +229,12 @@ impl Ls { let hard_links = 0; let user = 0; let group = 0; - let last_modified = { - let system_time = metadata.modified().unwrap(); - let now_utc: DateTime = system_time.into(); - now_utc.format("%b %e %H:%M") - }; + let last_modified = metadata + .modified() + .ok() + .and_then(|t| jiff::Timestamp::try_from(t).ok()) + .map(|ts| ts.strftime("%b %e %H:%M").to_string()) + .unwrap_or_default(); let path = file_info.path().to_string_lossy(); match writeln!( diff --git a/src/find/matchers/mod.rs b/src/find/matchers/mod.rs index a33d47c8..65e42f28 100644 --- a/src/find/matchers/mod.rs +++ b/src/find/matchers/mod.rs @@ -59,7 +59,6 @@ use self::time::{ use self::type_matcher::{TypeMatcher, XtypeMatcher}; use self::user::{NoUserMatcher, UserMatcher}; use ::regex::Regex; -use chrono::{DateTime, Datelike, NaiveDate, NaiveDateTime, Utc}; use fs::FileSystemMatcher; use ls::Ls; use std::{ @@ -372,11 +371,19 @@ fn convert_arg_to_comparable_value_and_suffix( /// When (time) is not provided, it will be automatically filled in as 00:00:00 /// such as: "jan 01, 2025" = "jan 01, 2025 00:00:00" -> 1735689600000 fn parse_date_str_to_timestamps(date_str: &str) -> Option { - if let Ok(datetime) = NaiveDateTime::parse_from_str(date_str, "%Y-%m-%d %H:%M:%S") { - return Some(datetime.and_utc().timestamp_millis()); + let to_utc_millis = |dt: jiff::civil::DateTime| { + Some( + jiff::tz::TimeZone::UTC + .to_timestamp(dt) + .ok()? + .as_millisecond(), + ) + }; + if let Ok(datetime) = jiff::civil::DateTime::strptime("%Y-%m-%d %H:%M:%S", date_str) { + return to_utc_millis(datetime); } - if let Ok(date) = NaiveDate::parse_from_str(date_str, "%Y-%m-%d") { - return Some(date.and_hms_opt(0, 0, 0)?.and_utc().timestamp_millis()); + if let Ok(date) = jiff::civil::Date::strptime("%Y-%m-%d", date_str) { + return to_utc_millis(date.to_datetime(jiff::civil::Time::midnight())); } let regex_pattern = @@ -384,23 +391,22 @@ fn parse_date_str_to_timestamps(date_str: &str) -> Option { let re = Regex::new(regex_pattern); if let Some(captures) = re.ok()?.captures(date_str) { - let now = Utc::now(); - let month_day = captures - .get(1) - .map_or(format!("{} {}", now.format("%b"), now.format("%d")), |m| { - m.as_str().to_string() - }); + let now = jiff::Timestamp::now().to_zoned(jiff::tz::TimeZone::UTC); + let month_day = captures.get(1).map_or( + format!("{} {}", now.strftime("%b"), now.strftime("%d")), + |m| m.as_str().to_string(), + ); // If no year input. let year = match captures.get(2) { Some(m) => m.as_str().parse().ok()?, - None => now.year(), + None => i32::from(now.year()), }; // If the user does not enter a specific time, it will be filled with 0 let time_str = captures.get(3).map_or("00:00:00", |m| m.as_str()); let date_time_str = format!("{month_day}, {year} {time_str}"); - let datetime = NaiveDateTime::parse_from_str(&date_time_str, "%b %d, %Y %H:%M:%S").ok()?; - let utc_datetime = DateTime::::from_naive_utc_and_offset(datetime, Utc); - Some(utc_datetime.timestamp_millis()) + let datetime = + jiff::civil::DateTime::strptime("%b %d, %Y %H:%M:%S", &date_time_str).ok()?; + to_utc_millis(datetime) } else { None } @@ -1821,12 +1827,14 @@ mod tests { // pass if return current time. let none_date_timestamps = parse_date_str_to_timestamps(""); - let now_but_zero_hour_min_sec = Utc::now() - .date_naive() - .and_hms_opt(0, 0, 0) + let midnight = jiff::Timestamp::now() + .to_zoned(jiff::tz::TimeZone::UTC) + .date() + .to_datetime(jiff::civil::Time::midnight()); + let now_but_zero_hour_min_sec = jiff::tz::TimeZone::UTC + .to_timestamp(midnight) .unwrap() - .and_utc() - .timestamp_millis(); + .as_millisecond(); assert_eq!(none_date_timestamps, Some(now_but_zero_hour_min_sec)); // A year of non-ASCII decimal digits must be rejected, not panic. diff --git a/src/find/matchers/printf.rs b/src/find/matchers/printf.rs index b3265b99..285658d4 100644 --- a/src/find/matchers/printf.rs +++ b/src/find/matchers/printf.rs @@ -11,8 +11,6 @@ use std::io::{stderr, Write}; use std::path::{Path, PathBuf}; use std::time::SystemTime; -use chrono::{format::StrftimeItems, DateTime, Local}; - use super::{FileType, Matcher, MatcherIO, WalkEntry, WalkError}; #[cfg(unix)] @@ -45,21 +43,13 @@ impl TimeFormat { format!("{}.{:09}0", duration.as_secs(), duration.subsec_nanos()) } Self::Ctime => { - const CTIME_FORMAT: &str = "%a %b %d %H:%M:%S.%f0 %Y"; - - DateTime::::from(time) - .format(CTIME_FORMAT) - .to_string() + const CTIME_FORMAT: &str = "%a %b %d %H:%M:%S.%9f0 %Y"; + let zoned = jiff::Timestamp::try_from(time)?.to_zoned(jiff::tz::TimeZone::system()); + jiff::fmt::strtime::format(CTIME_FORMAT, &zoned)? } Self::Strftime(format) => { - // Handle a special case - // GNU prints a fixed-width fraction: dot, nine nanosecond - // digits, plus a trailing literal zero. chrono's `%.f` would - // drop the fraction (and the dot) entirely when it is zero. - let custom_format = format.replace("%+", "%Y-%m-%d+%H:%M:%S.%f0"); - DateTime::::from(time) - .format(&custom_format) - .to_string() + let zoned = jiff::Timestamp::try_from(time)?.to_zoned(jiff::tz::TimeZone::system()); + jiff::fmt::strtime::format(format, &zoned)? } }; @@ -252,18 +242,15 @@ impl FormatStringParser<'_> { fn parse_time_specifier(&mut self, first: char) -> Result> { match self.advance_one()? { '@' => Ok(TimeFormat::SinceEpoch), - 'S' => Ok(TimeFormat::Strftime("%S.%f0".to_string())), + '+' => Ok(TimeFormat::Strftime("%Y-%m-%d+%H:%M:%S.%9f0".to_string())), + 'S' => Ok(TimeFormat::Strftime("%S.%9f0".to_string())), c => { - // We can't store the parsed items inside TimeFormat, because the items - // take a reference to the full format string, but we still try to parse - // it here so that errors get caught early. let format = format!("%{c}"); - match StrftimeItems::new(&format).next() { - None | Some(chrono::format::Item::Error) => { - Err(format!("Invalid time specifier: %{first}{c}").into()) - } - Some(_item) => Ok(TimeFormat::Strftime(format)), + let dummy = jiff::Timestamp::UNIX_EPOCH.to_zoned(jiff::tz::TimeZone::UTC); + if jiff::fmt::strtime::format(&format, &dummy).is_err() { + return Err(format!("Invalid time specifier: %{first}{c}").into()); } + Ok(TimeFormat::Strftime(format)) } } } @@ -702,7 +689,6 @@ mod tests { use std::fs::File; use std::io::{ErrorKind, Write}; - use chrono::{Duration, TimeZone}; use tempfile::Builder; use super::*; @@ -1194,13 +1180,16 @@ mod tests { let file_path = temp_dir.path().join(new_file_name); File::create(&file_path).expect("create temp file"); - let mtime = chrono::Local - .with_ymd_and_hms(2000, 1, 15, 9, 30, 21) - .unwrap() - + Duration::nanoseconds(2_000_000); + let mtime = jiff::civil::date(2000, 1, 15) + .at(9, 30, 21, 2_000_000) + .to_zoned(jiff::tz::TimeZone::system()) + .unwrap(); filetime::set_file_mtime( &file_path, - filetime::FileTime::from_unix_time(mtime.timestamp(), mtime.timestamp_subsec_nanos()), + filetime::FileTime::from_unix_time( + mtime.timestamp().as_second(), + mtime.timestamp().subsec_nanosecond() as u32, + ), ) .expect("set temp file mtime"); @@ -1212,7 +1201,7 @@ mod tests { assert_eq!( format!( "Sat Jan 15 09:30:21.0020000000 2000,{}.0020000000,2000-01-15", - mtime.timestamp() + mtime.timestamp().as_second() ), deps.get_output_as_string() ); @@ -1232,15 +1221,15 @@ mod tests { (0, "2000-01-15+09:30:21.0000000000"), (500_000_000, "2000-01-15+09:30:21.5000000000"), ] { - let mtime = chrono::Local - .with_ymd_and_hms(2000, 1, 15, 9, 30, 21) - .unwrap() - + Duration::nanoseconds(nanos); + let mtime = jiff::civil::date(2000, 1, 15) + .at(9, 30, 21, nanos) + .to_zoned(jiff::tz::TimeZone::system()) + .unwrap(); filetime::set_file_mtime( &file_path, filetime::FileTime::from_unix_time( - mtime.timestamp(), - mtime.timestamp_subsec_nanos(), + mtime.timestamp().as_second(), + mtime.timestamp().subsec_nanosecond() as u32, ), ) .expect("set temp file mtime"); diff --git a/src/find/matchers/time.rs b/src/find/matchers/time.rs index 384c2ad3..3266a629 100644 --- a/src/find/matchers/time.rs +++ b/src/find/matchers/time.rs @@ -7,9 +7,7 @@ use std::error::Error; use std::fs::{self, Metadata}; use std::io::{stderr, Write}; -use std::time::{Duration, SystemTime, UNIX_EPOCH}; - -use chrono::{DateTime, Local, Timelike}; +use std::time::{SystemTime, UNIX_EPOCH}; #[cfg(unix)] use std::os::unix::fs::MetadataExt; @@ -20,15 +18,12 @@ const SECONDS_PER_DAY: i64 = 60 * 60 * 24; fn get_time(matcher_io: &mut MatcherIO, today_start: bool) -> SystemTime { if today_start { - // the time at 00:00:00 of today - let duration_since_unix_epoch = matcher_io.now().duration_since(UNIX_EPOCH).unwrap(); - let seconds_since_unix_epoch = duration_since_unix_epoch.as_secs(); - let utc_time = DateTime::from_timestamp(seconds_since_unix_epoch as i64, 0).unwrap(); - let local_time = utc_time.with_timezone(&Local); - let seconds_since_last_midnight = local_time.num_seconds_from_midnight(); - let local_midnight_seconds = local_time.timestamp() - seconds_since_last_midnight as i64; - - UNIX_EPOCH + Duration::from_secs(local_midnight_seconds as u64) + let ts = jiff::Timestamp::try_from(matcher_io.now()).unwrap(); + let midnight = ts + .to_zoned(jiff::tz::TimeZone::system()) + .start_of_day() + .unwrap(); + SystemTime::from(midnight.timestamp()) } else { matcher_io.now() } @@ -398,7 +393,6 @@ impl FileAgeRangeMatcher { #[cfg(test)] mod tests { - use chrono::NaiveTime; use std::fs; use std::fs::{File, OpenOptions}; use std::io::Read; @@ -624,8 +618,10 @@ mod tests { let deps = FakeDependencies::new(); let midnight = get_time(&mut deps.new_matcher_io(), true); - let midnight = DateTime::::from(midnight); - assert_eq!(midnight.time(), NaiveTime::from_hms_opt(0, 0, 0).unwrap()); + let midnight = jiff::Timestamp::try_from(midnight) + .unwrap() + .to_zoned(jiff::tz::TimeZone::system()); + assert_eq!(midnight.time(), jiff::civil::time(0, 0, 0, 0)); } #[test] diff --git a/src/find/matchers/user.rs b/src/find/matchers/user.rs index 92ce2216..a1dab7f1 100644 --- a/src/find/matchers/user.rs +++ b/src/find/matchers/user.rs @@ -93,7 +93,6 @@ mod tests { fn test_user_matcher() { use crate::find::matchers::{tests::get_dir_entry_for, user::UserMatcher, Matcher}; use crate::find::tests::FakeDependencies; - use chrono::Local; use nix::unistd::{Uid, User}; use std::fs::File; use std::os::unix::fs::MetadataExt; @@ -119,7 +118,7 @@ mod tests { ); // Testing a non-existent group name - let time_string = Local::now().format("%Y%m%d%H%M%S").to_string(); + let time_string = jiff::Zoned::now().strftime("%Y%m%d%H%M%S").to_string(); let matcher = UserMatcher::from_user_name(time_string.as_str()); assert!( matcher.is_none(), diff --git a/src/locate/mod.rs b/src/locate/mod.rs index d270f3e0..992eb372 100644 --- a/src/locate/mod.rs +++ b/src/locate/mod.rs @@ -12,7 +12,6 @@ use std::{ str::FromStr, }; -use chrono::{DateTime, Local, TimeDelta}; use clap::{self, crate_version, value_parser, Arg, ArgAction, ArgMatches, Command, Id}; use itertools::Itertools; use onig::{Regex, RegexOptions, Syntax}; @@ -132,8 +131,14 @@ impl Statistics { fn print(&self, out: &mut W, dbreader: &DbReader) -> io::Result<()> { if let Ok(metadata) = fs::metadata(&dbreader.path) { if let Ok(time) = metadata.modified() { - let time: DateTime = time.into(); - writeln!(out, "Database was last modified at {}", time)?; + if let Ok(ts) = jiff::Timestamp::try_from(time) { + let time = ts.to_zoned(jiff::tz::TimeZone::system()); + writeln!( + out, + "Database was last modified at {}", + time.strftime("%Y-%m-%d %H:%M:%S.%9f %:z") + )?; + } } writeln!(out, "Locate database size: {} bytes", metadata.len())?; } @@ -594,12 +599,15 @@ fn match_entry(entry: &CStr, config: &Config, patterns: &Patterns) -> bool { } /// Whether a database of the given `age` is older than `max_age` days. -/// A `max_age` too large for `i64`/`chrono` to represent can never be exceeded. -fn is_db_too_old(age: TimeDelta, max_age: usize) -> bool { - match i64::try_from(max_age).ok().and_then(TimeDelta::try_days) { - Some(limit) => age > limit, - None => false, - } +/// A `max_age` too large for `i64` to represent can never be exceeded. +fn is_db_too_old(age: jiff::SignedDuration, max_age: usize) -> bool { + let Some(limit_secs) = i64::try_from(max_age) + .ok() + .and_then(|d| d.checked_mul(60 * 60 * 24)) + else { + return false; + }; + age.as_secs() > limit_secs } fn do_locate(args: &[&str]) -> LocateResult<()> { @@ -634,17 +642,18 @@ fn do_locate(args: &[&str]) -> LocateResult<()> { // if we can get the mtime of the file, check it against the current time if let Ok(metadata) = fs::metadata(&dbreader.path) { if let Ok(time) = metadata.modified() { - let modified: DateTime = time.into(); - let now = Local::now(); - let delta = now - modified; - if is_db_too_old(delta, config.max_age) { - eprintln!( - "{}: warning: database ‘{}’ is more than {} days old (actual age is {:.1} days)", - args[0], - dbreader.path.to_string_lossy(), - config.max_age, - delta.num_seconds() as f64 / (60 * 60 * 24) as f64 - ); + if let Ok(modified) = jiff::Timestamp::try_from(time) { + let now = jiff::Timestamp::now(); + let delta = now.duration_since(modified); + if is_db_too_old(delta, config.max_age) { + eprintln!( + "{}: warning: database ‘{}’ is more than {} days old (actual age is {:.1} days)", + args[0], + dbreader.path.to_string_lossy(), + config.max_age, + delta.as_secs() as f64 / (60.0 * 60.0 * 24.0) + ); + } } } } @@ -721,8 +730,6 @@ mod tests { use std::io::{self, Write}; use std::path::Path; - use chrono::TimeDelta; - use super::{is_db_too_old, path_exists, DbReader, Statistics}; /// A writer that always fails, to emulate stdout with no space left @@ -754,20 +761,17 @@ mod tests { #[test] fn db_too_old_compares_ordinary_ages() { - let day = TimeDelta::days(1); + let day = jiff::SignedDuration::from_hours(24); assert!(is_db_too_old(day, 0)); assert!(!is_db_too_old(day, 8)); } #[test] fn db_too_old_ignores_max_age_beyond_i64() { - assert!(!is_db_too_old(TimeDelta::days(1), usize::MAX)); - } - - #[test] - #[cfg(target_pointer_width = "64")] - fn db_too_old_ignores_max_age_beyond_chrono_range() { - assert!(!is_db_too_old(TimeDelta::days(1), 1_000_000_000_000)); + assert!(!is_db_too_old( + jiff::SignedDuration::from_hours(24), + usize::MAX + )); } /// Create a symlink at `link` pointing at `target`, cross-platform.