From 8b1da4b63d62d4bdff908f9301a121e2c11bb972 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Tue, 20 Sep 2022 16:05:46 +0200 Subject: [PATCH] path: Actually use mtime instead of ctime Fixes #9222 --- src/builtins/path.cpp | 4 ++-- tests/checks/path.fish | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/builtins/path.cpp b/src/builtins/path.cpp index aa0fb2fae..4a595093b 100644 --- a/src/builtins/path.cpp +++ b/src/builtins/path.cpp @@ -623,9 +623,9 @@ static int path_mtime(parser_t &parser, io_streams_t &streams, int argc, const w n_transformed++; if (!opts.relative) { - path_out(streams, opts, to_string(ret.change_seconds)); + path_out(streams, opts, to_string(ret.mod_seconds)); } else { - path_out(streams, opts, to_string(t - ret.change_seconds)); + path_out(streams, opts, to_string(t - ret.mod_seconds)); } } } diff --git a/tests/checks/path.fish b/tests/checks/path.fish index 79c1a5dd2..f4a9c0f3e 100644 --- a/tests/checks/path.fish +++ b/tests/checks/path.fish @@ -216,3 +216,7 @@ or echo mtime is too small test $mtime -lt 20 or echo mtime is too large + +touch -m -t 197001020000.00 epoch +path mtime epoch +# CHECK: 82800