Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: Make ztrftime pass more things to strftime
- X-seq: zsh-workers 35740
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: "Jun T." <takimoto-j@xxxxxxxxxxxxxxxxx>
- Subject: Re: PATCH: Make ztrftime pass more things to strftime
- Date: Thu, 9 Jul 2015 06:36:54 +0200
- Cc: zsh workers <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=ww0PA3x7EWkeOW60xaXW1h7hqEkkG30VC0XYFWnxu/M=; b=r7grHFA+ky/CoTi7DVr6nG+Q8mLeRvd24In209AcX4QUGz9MkX2vzFlZGU+dGcWh4S niIFPJW/t+grE+t2hXJq8fVarIb3YKHegvvqDa2J5ntToeeyl5pzSkUOo8LqbqcFZym8 e+YH7u1Hcr9jbBuqZ2mSdxcCc13QeF8inX1LzWo8HB4NZwvWj1qy2ePCfFhwowt4gQ9k 1LcLiVnz4d4E1LHeckD08jbeM8S070X85/Wz1RHLDVQ569Z/vsq7LLsaltrjgI7kFix/ pPto59c+HUWdCeZM4Xv4fBW32O9vu8GESj4fv+BrhrYEVhy0DB2pHTTGnSyRNhEqnGe2 4OVA==
- In-reply-to: <D4FC70DD-31AF-489A-89C6-5F6A6FED1BFD@kba.biglobe.ne.jp>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <1436310900-9519-1-git-send-email-mikachu@gmail.com> <CAHYJk3TnDVEUVuGSec7j5j7ATqtkFwMJcT-7WucH8sRdMv=X9g@mail.gmail.com> <D4FC70DD-31AF-489A-89C6-5F6A6FED1BFD@kba.biglobe.ne.jp>
On Wed, Jul 8, 2015 at 4:03 PM, Jun T. <takimoto-j@xxxxxxxxxxxxxxxxx> wrote:
>
> 2015/07/08 08:21, Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>> % print -P %D\{%x\}
>> 2015年07月08日
>> % print -P %D\{%Ex\}
>> 平成27年07月08日
>
> It works for %Ex but not for %Ey.
> ztrftime() does not send %Ey to strftime() but ignores E and
> handles %y by itself.
>
> % date +%y
> 15
> % date +%Ey
> 27
> % print -P '%D{%y %Ey}'
> 15 15
>
> Is it possible to pass the entire format string to strftime()
> if HAVE_STRFTIME is defined?
With my latest patch, I can now do this,
% print -P '%D{%y %Ey %f}'
15 27 9
% date +'%y %Ey %f'
15 27 %f
If anyone wants me to make %3f work, I humbly ask them to keep this to
themselves.
Bonus, weird stuff strftime() does:
% date +%014EA #zeropadding the unchanged format string
00000000%014EA
% date +%020Ey #padding Ey is fine
00000000000000000027
% date +%020Oy #but not Oy
十五
% date +%_20Oe #not any O* it seems
九
% date +%020Oe #applies to english locale too
9
If you find any problems, please check that it doesn't happen with
date with the same format string.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author