summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2021-01-13 09:41:42 -0500
committerTavian Barnes <tavianator@tavianator.com>2021-01-13 09:41:42 -0500
commitff215e6665c03e37fcb640a0a431a3bee5f7bbaf (patch)
tree1c48fc87b2ca044087a405de83d2a350b1fa2da1
parent2ca72a38dad1a4afcdbb00e536384024532059a4 (diff)
downloadbfs-ff215e6665c03e37fcb640a0a431a3bee5f7bbaf.tar.xz
-used: Make the implementation match the GNU fixes for findutils 4.8.0
-rw-r--r--eval.c9
1 files changed, 7 insertions, 2 deletions
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);
}