testsAndMisc/linux_configuration/i3-configuration/i3blocks/time.sh

16 lines
274 B
Bash
Executable File

#!/bin/bash
# i3blocks clock, persist mode with zero external helpers in the hot path.
set -uo pipefail
emit() {
printf ' %(%Y-%m-%d %H:%M)T\n' -1
}
while :; do
emit
printf -v now '%(%s)T' -1
delay=$((60 - now % 60))
IFS= read -r -t "$delay" _ || true
done