2021-10-18 02:47:32 -07:00
|
|
|
#!/usr/bin/env sh
|
2024-07-22 05:28:58 -07:00
|
|
|
# compat: +ash +bash +dash +zsh
|
2021-10-18 02:47:32 -07:00
|
|
|
|
|
|
|
dated() {
|
2021-10-18 17:36:47 -07:00
|
|
|
local ts= u=0
|
2021-10-18 02:47:32 -07:00
|
|
|
[ "$1" != -u ] || { shift; u=1; }
|
|
|
|
if [ $# = 0 ]; then
|
|
|
|
# -u doesn't actually do anything here, but...
|
|
|
|
if [ $u = 1 ]; then date -u '+%s'; else date '+%s'; fi
|
|
|
|
fi
|
2021-10-18 17:36:47 -07:00
|
|
|
for ts; do
|
|
|
|
if [ $u = 1 ]; then date -u -d '@'"$ts"; else date -d '@'"$ts"; fi
|
|
|
|
done
|
2021-10-18 02:47:32 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
[ -n "${preload+-}" ] || dated "$@"
|