git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: clime <clime7@gmail.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: :format:%s for date fields seems to be shifted by timezone
Date: Wed, 6 May 2020 15:06:51 -0400	[thread overview]
Message-ID: <20200506190651.GA2421358@coredump.intra.peff.net> (raw)
In-Reply-To: <CAGqZTUs+xCPjQdeQVfU6EWARmZdjcgcHeSNxkKaTf316rX+8pg@mail.gmail.com>

On Wed, May 06, 2020 at 08:03:52PM +0200, clime wrote:

> what about just printing the raw timestamp from either commit or tag,
> i.e. avoiding any conversion for format:%s?

We don't parse the "%s" ourselves at all. We feed everything after the
colon to the system strftime(), and that function only takes a
broken-down "struct tm".

That said, we do already intercept "%z" for similar reasons in
strbuf_addftime(). So it would probably be possible to declare that we
don't respect system "%s" and just handle it ourselves. It would require
either massaging the "tm" back to a time_t, or changing the signature to
take a redundant time_t (and not all callers might have that).

So if somebody wants to work on a patch in that direction, we could see
how ugly it ends up being. But I am reasonably happy with "don't do
that" as a solution in the meantime.

-Peff

      reply	other threads:[~2020-05-06 19:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-03 10:15 :format:%s for date fields seems to be shifted by timezone clime
2020-05-04 15:43 ` Jeff King
2020-05-06 18:03   ` clime
2020-05-06 19:06     ` 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=20200506190651.GA2421358@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=clime7@gmail.com \
    --cc=git@vger.kernel.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://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).