help / color / mirror / code / Atom feed
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,


[-- Attachment #2: Type: text/html, Size: 2509 bytes --]

             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:

* 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 \
    --subject='Re: Possible inconsistency with use of TZ to change zone output '\''%Z"' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:


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).