1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

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.
This commit is contained in:
Michael Vogt 2024-03-30 11:17:22 +01:00
parent 28f7d56f6d
commit a2f8084d48

View file

@ -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]