Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Possible inconsistency with use of TZ to change zone output '%Z"



On Sat, Jan 8, 2022 at 7:33 AM Jim <linux.tech.guy@xxxxxxxxx> wrote:
>
> Unfortunately my searches never found that mail thread. Sorry about that.
> I'm sure the print builtin has nothing to do with the results I am getting.

I didn't mean to imply that you should have found that thread on your
own, sorry.  The significant bit is that there is some discussion of
possible patches in that thread.

> But if parameter expansion is using zsh's strftime shouldn't it act the
> same way as calling strftime directly.

The %-replacements for zsh's strftime do not map 1-to-1 onto every
underlying strftime implementation, so it's not a direct pass-through.
However --

> 1) DT=${(%):-%D{$Fmt}}
> 2) zstat -F $Fmt -A A +mtime $F
> 3) strftime -s DT $Fmt $ET

-- the patch discussion from the other thread comes down to:  In the
third case, the strftime builtin has an execution context in which it
is able to implicitly create a temporary export of TZ and then delete
it again before returning, so it does that (this was a change
implemented some time after the datetime module was first created).
In the first case there is no such context so a solution is messy, and
in the second (zstat) case the equivalent export has simply never been
implemented even though it would be possible to do so.




Messages sorted by: Reverse Date, Date, Thread, Author