From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 23FA31F953 for ; Tue, 2 Nov 2021 15:43:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234342AbhKBPpr (ORCPT ); Tue, 2 Nov 2021 11:45:47 -0400 Received: from cloud.peff.net ([104.130.231.41]:51562 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231526AbhKBPpr (ORCPT ); Tue, 2 Nov 2021 11:45:47 -0400 Received: (qmail 2980 invoked by uid 109); 2 Nov 2021 15:43:11 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 02 Nov 2021 15:43:11 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 7204 invoked by uid 111); 2 Nov 2021 15:43:11 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Tue, 02 Nov 2021 11:43:11 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 2 Nov 2021 11:43:11 -0400 From: Jeff King To: Junio C Hamano Cc: Dongsheng Song , Git Mailing List Subject: Re: [PATCH] strbuf_addftime(): handle "%s" manually Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org 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