I am using EPOCHREALTIME and then computing the corresponding human readable
form, that can handle
changes in locale
now=$EPOCHREALTIME
printf -v second '%(%S)T.%s' "${now%[^[:digit:]]*}" "${now#*[^[:digit:]]}"
printf -v minute '%(%M)T' "${now%[^[:digit:]]*}"
printf -v hour '%(%H)T' "${now%[^[:digit:]]*}"
Incidentally, [![:digit:]] does not work there, you need to use the
POSIX-specified caret (^) instead of an
exclamation mark when using character classes. I'm not sure if this is
intentional or a bug in bash; man
page doesn't seem to mention it.