From ff215e6665c03e37fcb640a0a431a3bee5f7bbaf Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 13 Jan 2021 09:41:42 -0500 Subject: -used: Make the implementation match the GNU fixes for findutils 4.8.0 --- eval.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index bb93c12..6abdaf2 100644 --- a/eval.c +++ b/eval.c @@ -261,8 +261,13 @@ bool eval_used(const struct expr *expr, struct eval_state *state) { return false; } - time_t diff = timespec_diff(atime, ctime); - diff /= 60*60*24; + long long diff = timespec_diff(atime, ctime); + if (diff < 0) { + return false; + } + + long long day_seconds = 60*60*24; + diff = (diff + day_seconds - 1) / day_seconds; return expr_cmp(expr, diff); } -- cgit v1.2.3