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: Tue, 2 Nov 2021 11:43:11 -0400 [thread overview]
Message-ID: <YYFcj0Y9ApBU9j+V@coredump.intra.peff.net> (raw)
In-Reply-To: <YYEihoLbEGi44dDb@coredump.intra.peff.net>
On Tue, Nov 02, 2021 at 07:35:35AM -0400, Jeff King wrote:
> @@ -1019,6 +1024,13 @@ void strbuf_addftime(struct strbuf *sb, const char *fmt, const struct tm *tm,
> strbuf_addstr(&munged_fmt, "%%");
> fmt++;
> break;
> + case 's':
> + strbuf_addf(&munged_fmt, "%"PRItime,
> + tm_to_time_t(tm) -
> + 3600 * (tz_offset / 100) -
> + 60 * (tz_offset % 100));
> + fmt++;
> + break;
Looks like we may need something like this squashed in:
diff --git a/strbuf.c b/strbuf.c
index 33015b33df..995394f38e 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -1026,7 +1026,7 @@ void strbuf_addftime(struct strbuf *sb, const char *fmt, const struct tm *tm,
break;
case 's':
strbuf_addf(&munged_fmt, "%"PRItime,
- tm_to_time_t(tm) -
+ (timestamp_t)tm_to_time_t(tm) -
3600 * (tz_offset / 100) -
60 * (tz_offset % 100));
fmt++;
because tm_to_time_t() returns an actual time_t, which will vary in
size. The 32-bit CI job complains:
strbuf.c:1028:29: error: format '%lld' expects argument of type 'long long int', but argument 3 has type 'long int' [-Werror=format=]
-Peff
next prev parent reply other threads:[~2021-11-02 15:43 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 [this message]
2021-11-03 20:28 ` Junio C Hamano
2021-11-04 2:11 ` Jeff King
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=YYFcj0Y9ApBU9j+V@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).