git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Dongsheng Song <dongsheng.song@gmail.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] strbuf_addftime(): handle "%s" manually
Date: Wed, 3 Nov 2021 22:11:06 -0400	[thread overview]
Message-ID: <YYNBOp4QDwG9ctHE@coredump.intra.peff.net> (raw)
In-Reply-To: <xmqqtugt56i7.fsf@gitster.g>

On Wed, Nov 03, 2021 at 01:28:00PM -0700, Junio C Hamano wrote:

> I think this also needs squashing in?
> 
>  Documentation/rev-list-options.txt | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git c/Documentation/rev-list-options.txt w/Documentation/rev-list-options.txt
> index 24569b06d1..43a86fa562 100644
> --- c/Documentation/rev-list-options.txt
> +++ w/Documentation/rev-list-options.txt
> @@ -1047,7 +1047,7 @@ omitted.
>  has no effect.
>  
>  `--date=format:...` feeds the format `...` to your system `strftime`,
> -except for %z and %Z, which are handled internally.
> +except for %s, %z, and %Z, which are handled internally.
>  Use `--date=format:%c` to show the date in your system locale's
>  preferred format.  See the `strftime` manual for a complete list of
>  format placeholders. When using `-local`, the correct syntax is

Ah, thanks. I didn't even think to look in the documentation, because I
didn't imagine that we would expose these implementation details. But
since we do mention %z there, I think adding %s makes sense.

BTW, I also noticed that stftime supports some locale modifiers. So
"%Es" ends up printing the epoch seconds, but eludes our manual
intervention (and so does the old, wrong thing). I'm fine with stopping
here, though. There's no reason to use %Es over %s (from what I gather,
the %E is about handling year eras for locales that support them, but
that's meaningless for an epoch time), and I'm not sure it is even a
portable thing (glibc does not mention it in the manpage along with
other %E values, but it does work; POSIX does not even define %s, so of
course does not mention %Es).

-Peff

      reply	other threads:[~2021-11-04  2:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-31  3:23 timezone related bug of git Dongsheng Song
2021-10-31  8:53 ` Jeff King
2021-10-31 13:18   ` Dongsheng Song
2021-10-31 18:46     ` Junio C Hamano
2021-11-01  4:03       ` Jeff King
2021-11-01 14:31         ` Dongsheng Song
2021-11-01 18:18         ` Junio C Hamano
2021-11-02  1:43           ` Jeff King
2021-11-02 11:35           ` [PATCH] strbuf_addftime(): handle "%s" manually Jeff King
2021-11-02 15:43             ` Jeff King
2021-11-03 20:28             ` Junio C Hamano
2021-11-04  2:11               ` Jeff King [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YYNBOp4QDwG9ctHE@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=dongsheng.song@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).