summaryrefslogtreecommitdiffstats
path: root/tests/common/mtime.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/common/mtime.sh')
-rw-r--r--tests/common/mtime.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/common/mtime.sh b/tests/common/mtime.sh
new file mode 100644
index 0000000..7ba127e
--- /dev/null
+++ b/tests/common/mtime.sh
@@ -0,0 +1,15 @@
+cd "$TEST"
+
+now=$(epoch_time)
+
+"$XTOUCH" -mt "@$((now - 60 * 60 * 24 * 7))" last_week
+"$XTOUCH" -mt "@$((now - 60 * 60 * 49))" two_days_ago
+"$XTOUCH" -mt "@$((now - 60 * 60 * 25))" yesterday
+"$XTOUCH" -mt "@$((now - 60 * 60))" one_hour_ago
+"$XTOUCH" -mt "@$((now))" now
+"$XTOUCH" -mt "@$((now + 60 * 60 * 24))" tomorrow
+
+bfs_diff -mindepth 1 \
+ \( -mtime -1 -exec printf -- '-mtime -1: %s\n' {} \; -o -true \) \
+ \( -mtime 1 -exec printf -- '-mtime 1: %s\n' {} \; -o -true \) \
+ \( -mtime +1 -exec printf -- '-mtime +1: %s\n' {} \; -o -true \)