summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);
}