At 2020-12-12T21:19:38-0800, Jim Avera wrote:
I suspect groff is always in UTC (but haven't confirmed).
No, that is not true, at least not in groff as provided by GNU.  A
downstream distributor, like a GNU/Linux distribution, could alter this.
Hmm.  In Ubuntu 20.04 `groff --version` says "version 1.22.4", but seems to ignore TZ and always uses UTC for \n[hours].

Here is a demo script:

#!/bin/sh
for varlist in \
   'PATH=/bin:/usr/bin' \
   'PATH=/bin:/usr/bin TZ=UTC' \
   'PATH=/bin:/usr/bin TZ=America/New_York' \
   'PATH=/bin:/usr/bin TZ=America/Los_Angeles' \
; do
  echo "--------------------------------------"
  eval "env -i $varlist /bin/sh" <<'SHELLEOF'
(set -x; env)
echo -n "date  says: "; date +'%Y-%m-%d %H:%M:%S'
groff <<'GEND' 2>&1 >/dev/null
.tm groff says: \n[year]-\n[mo]-\n[dy] \n[hours]:\n[minutes]:\n[seconds]
GEND
SHELLEOF
done

And here's output from my system.   Note that \n[hours] is always UTC:

--------------------------------------
+ env
PATH=/bin:/usr/bin
PWD=/home/jima/ptmp
date  says: 2020-12-15 13:28:42
groff says: 2020-12-15 21:28:42
--------------------------------------
+ env
PATH=/bin:/usr/bin
PWD=/home/jima/ptmp
TZ=UTC
date  says: 2020-12-15 21:28:42
groff says: 2020-12-15 21:28:42
--------------------------------------
+ env
PATH=/bin:/usr/bin
PWD=/home/jima/ptmp
TZ=America/New_York
date  says: 2020-12-15 16:28:42
groff says: 2020-12-15 21:28:42
--------------------------------------
+ env
PATH=/bin:/usr/bin
PWD=/home/jima/ptmp
TZ=America/Los_Angeles
date  says: 2020-12-15 13:28:42
groff says: 2020-12-15 21:28:42




Reply via email to