9 *s*) SHELLSTART=$(perl -e 'print time') ; DATESECS=false ;; # take a shot
14 printf "%(abde)Z\n" -1
16 printf "%(%e-%b-%Y %T)T\n" $SECS
18 printf -v v1 "%(%e-%b-%Y %T)T\n" $( $DATESECS && date +%s || perl -e 'print time')
19 printf -v v2 "%(%e-%b-%Y %T)T\n" -1
23 *) echo "current time and -1 possible mismatch|$v1|$v2|" >&2 ;;
28 printf -v v2 "%(%s)T" -1
32 *) echo "current time mismatch:$v1|$v2|" >&2 ;;
36 printf "%(%x %X)T\n" $(( $SECS - 3600 ))
38 printf -v v1 "%(%F %r)T\n" $SHELLSTART
39 printf -v v2 "%(%F %r)T\n" -2
43 *) echo "shell start time and -2 possible mismatch|$v1|$v2|" >&2 ;;
47 printf "current time: %(%F %r)T\n" $SECS
49 printf "epoch time: %(%F %r %z)T\n" 0
50 printf "random time: %(%F %r %z)T\n" $SECS
52 printf "local time: %(%a %b %e %H:%M:%S %Z %Y)T\n" $SECS
54 # test fieldwidth, justification, precision
55 printf "%-40.50(%a %b %e %H:%M:%S %Z %Y)T date-style time\n" $SECS
57 # test fieldwidth, justification, precision, embedded parens
58 printf "%-40.50(%x (foo) %X)T date-style time\n" $SECS
60 # problem introduced in bash-4.2 patch 5
62 printf '%(%Y-%m-%d %H:%M:%S %Z)T\n' >/dev/null