Re: :format:%s for date fields seems to be shifted by timezone
- From
Jeff King <peff@peff.net>
- Date
- May 6, 2020, 19:06 UTC
- Message-ID
- <20200506190651.GA2421358@coredump.intra.peff.net>
- 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