On 2011-10-21 23:20:21 +0200, W. Martin Borgert wrote:
> Maybe this is only my misunderstanding or a documentation
> omission. But I'm under the impression, that date prints
> the timezone incorrect in some cases:
>
> $ for tz in UTC UTC+2 UTC-2 ; do TZ=$tz date ; done
> Fri Oct 21 20:55:45 UTC 2011
> Fri Oct 21 18:55:45 UTC 2011
> Fri Oct 21 22:55:45 UTC 2011
This is not specific to UTC and GMT. For instance:
cventin:~> for tz in CET CET+2 CET-2 ; do TZ=$tz date ; done
Wed Apr 10 13:47:12 CEST 2019
Wed Apr 10 09:47:12 CET 2019
Wed Apr 10 13:47:12 CET 2019
The offest is just ignored in the output. There is the same issue
under {Open,Net,Free}BSD and under Solaris.
And also with strftime (not sure whether "date" is completely based
on it, ltrace gives strange output, possibly missing library calls):
cventin:~> for tz in UTC UTC+2 UTC-2 ; do TZ=$tz perl -MPOSIX -e 'print
strftime "%c\n", localtime' ; done
2019-04-10T12:07:55 UTC
2019-04-10T10:07:55 UTC
2019-04-10T14:07:55 UTC
--
Vincent Lefèvre <[email protected]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)