| 
1 |  | -iso8601() {  | 
2 |  | -    printf '%04d-%02d-%02dT%02d:%02d:%02d\n' "$@"  | 
3 |  | -}  | 
4 |  | - | 
5 | 1 | cd "$TEST"  | 
6 | 2 | 
 
  | 
7 |  | -now=$(date '+%Y-%m-%dT%H:%M:%S')  | 
8 |  | - | 
9 |  | -# Parse the current date  | 
10 |  | -[[ "$now" =~ ^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})$ ]] || fail  | 
11 |  | -# Treat leading zeros as decimal, not octal  | 
12 |  | -YYYY=$((10#${BASH_REMATCH[1]}))  | 
13 |  | -MM=$((10#${BASH_REMATCH[2]}))  | 
14 |  | -DD=$((10#${BASH_REMATCH[3]}))  | 
15 |  | -hh=$((10#${BASH_REMATCH[4]}))  | 
16 |  | -mm=$((10#${BASH_REMATCH[5]}))  | 
17 |  | -ss=$((10#${BASH_REMATCH[6]}))  | 
 | 3 | +now=$(epoch_time)  | 
18 | 4 | 
 
  | 
19 | 5 | # -used is always false if atime < ctime  | 
20 |  | -yesterday=$(iso8601 $YYYY $MM $((DD - 1)) $hh $mm $ss)  | 
21 |  | -"$XTOUCH" -at "$yesterday" yesterday  | 
 | 6 | +"$XTOUCH" -at "@$((now - 60 * 60 * 24))" yesterday  | 
22 | 7 | 
 
  | 
23 | 8 | # -used rounds up  | 
24 |  | -tomorrow=$(iso8601 $YYYY $MM $DD $((hh + 1)) $mm $ss)  | 
25 |  | -"$XTOUCH" -at "$tomorrow" tomorrow  | 
 | 9 | +"$XTOUCH" -at "@$((now + 60 * 60))" tomorrow  | 
26 | 10 | 
 
  | 
27 |  | -dayafter=$(iso8601 $YYYY $MM $((DD + 1)) $((hh + 1)) $mm $ss)  | 
28 |  | -"$XTOUCH" -at "$dayafter" dayafter  | 
 | 11 | +"$XTOUCH" -at "@$((now + 60 * 60 * 25))" dayafter  | 
29 | 12 | 
 
  | 
30 |  | -nextweek=$(iso8601 $YYYY $MM $((DD + 6)) $((hh + 1)) $mm $ss)  | 
31 |  | -"$XTOUCH" -at "$nextweek" nextweek  | 
 | 13 | +"$XTOUCH" -at "@$((now + 60 * 60 * (24 * 6 + 1)))" nextweek  | 
32 | 14 | 
 
  | 
33 |  | -nextyear=$(iso8601 $((YYYY + 1)) $MM $DD $hh $mm $ss)  | 
34 |  | -"$XTOUCH" -at "$nextyear" nextyear  | 
 | 15 | +"$XTOUCH" -at "@$((now + 60 * 60 * 24 * 365))" nextyear  | 
35 | 16 | 
 
  | 
36 | 17 | bfs_diff -mindepth 1 \  | 
37 | 18 |     -a -used 1 -printf '-used 1: %p\n' \  | 
 | 
0 commit comments