From a2f8084d488645d4c5b29b0bf0afee6cd2a3b5a5 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sat, 30 Mar 2024 11:17:22 +0100 Subject: [PATCH] tests: fix deprecation warning `timestamp_subsec_nanos()` When building coreutils I got the following deprecation warning: ``` warning: use of deprecated method `chrono::NaiveDateTime::timestamp_subsec_nanos`: use `.and_utc().timestamp_subsec_nanos()` instead --> tests/by-util/test_touch.rs:37:59 | 37 | ..._utc().timestamp(), tm.timestamp_subsec_nanos()) | ^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(deprecated)]` on by default warning: `coreutils` (test "tests") generated 1 warning ``` This commit fixes it. --- tests/by-util/test_touch.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/by-util/test_touch.rs b/tests/by-util/test_touch.rs index 5910da7f8..03df2973d 100644 --- a/tests/by-util/test_touch.rs +++ b/tests/by-util/test_touch.rs @@ -34,7 +34,7 @@ fn set_file_times(at: &AtPath, path: &str, atime: FileTime, mtime: FileTime) { fn str_to_filetime(format: &str, s: &str) -> FileTime { let tm = chrono::NaiveDateTime::parse_from_str(s, format).unwrap(); - FileTime::from_unix_time(tm.and_utc().timestamp(), tm.timestamp_subsec_nanos()) + FileTime::from_unix_time(tm.and_utc().timestamp(), tm.and_utc().timestamp_subsec_nanos()) } #[test]