From: Jim <linux.tech.guy@gmail.com>
To: zsh <zsh-users@zsh.org>
Subject: Possible inconsistency with use of TZ to change zone output '%Z"
Date: Thu, 6 Jan 2022 18:39:35 -0600 [thread overview]
Message-ID: <CA+rB6GKHQWng-N=S8ypjernxDYoKtsKZqMMBoXjTaYrywgPzoA@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1321 bytes --]
1) using parameter expansion flag '%'
2) zsh/stat module
3) zsh/datetime module - strftime
TZ=UTC in all cases
All methods in outputting a time string appear to use strftime. zsh/stat
doesn't say so in man page, but uses the same formatting.
TZ is not treated the same way in all three uses. Parameter expansion
and zstat need TZ to be exported to give the correct result. Whereas
strftime does not.
1) Using parameter expansion flag '%' to get current date/time
module zsh/datetime loaded Yes DT=${(%):-%D{%Y-%m-%d_%H:%M:%S.%N_%Z}}
TZ exported NOT 2022-01-06_17:08:34.957909030_CST
TZ exported Yes 2022-01-06_23:08:34.958007858_UTC
module zsh/datetime loaded NOT DT=${(%):-%D{%Y-%m-%d_%H:%M:%S.%N_%Z}
TZ exported NOT 2022-01-06_17:08:34.958192556_CST
TZ exported Yes 2022-01-06_23:08:34.958318194_UTC
2) Output from zstat:
TZ exported NOT 2021-07-25_13:53:11.000000000_CDT
TZ exported Yes 2021-07-25_18:53:11.000000000_UTC
3) Output from strftime:
TZ exported NOT 2021-07-25_18:53:11.000000000_UTC
TZ exported Yes 2021-07-25_18:53:11.000000000_UTC
Can anyone tell me why TZ needs to be exported for 1 and 2, but not 3?
Personally I prefer not to have to export TZ to get the desired result,
but that's just me. I don't know the reasoning with each.
Thank in advance for any info you can offer,
Jim
[-- Attachment #2: Type: text/html, Size: 2509 bytes --]
next reply other threads:[~2022-01-07 0:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-07 0:39 Jim [this message]
2022-01-07 0:58 ` Bart Schaefer
2022-01-08 15:32 ` Jim
2022-01-12 19:09 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CA+rB6GKHQWng-N=S8ypjernxDYoKtsKZqMMBoXjTaYrywgPzoA@mail.gmail.com' \
--to=linux.tech.guy@gmail.com \
--cc=linuxtechguy@gmail.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).