From: Paul Eggert <eggert@cs.ucla.edu>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Eric Wong <e@80x24.org>
Subject: Re: [PATCH 2/2] git-compat-util: use gettimeofday for current time
Date: Mon, 20 Mar 2023 12:00:22 -0700 [thread overview]
Message-ID: <047178a8-ccf5-1cab-e670-8f1c64f9ca3c@cs.ucla.edu> (raw)
In-Reply-To: <xmqqr0tjmk6d.fsf@gitster.g>
On 3/20/23 10:01, Junio C Hamano wrote:
>> I however wonder if we should follow our
>> usual pattern of implementing git_time() with the identical function
>> signature as what we replace (i.e. system's time()), and #undef/#define
>> the symbol we replace with git_time, though. Wouldn't it make [1/2]
>> a lot smaller and future-proof?
Yes, something like that would work too. (Sorry, I didn't know about the
usual pattern.)
> +# Define OVERRIDE_TIME to override time(2) and replace it with an
> +# implementation based on gettimeofday(2). THis is necessary when
> +# glibc 2.31+ on Linux is used, where in the first 1 to 2.5 ms of
> +# every second, time(NULL) returns a value that is one less than the
> +# tv_sec part of higher-resolution timestamps used in the file system.
THis -> This
It might be simpler to use the gettimeofday workaround on all platforms,
rather than having an OVERRIDE_TIME flag and complicating
config.mak.uname. gettimeofday should be portable, as it's already used
elsewhere in Git without configury.
If we're going with the more-complicated solution, config.mak.uname will
need changes in its AIX and MS-Windows sections because the problem is
known to occur there too. Although AIX configuration is simple, I'm not
sure how to go about the MS-Windows part as there seem to be a lot of
ifdefs there. Also, because the time problem does not occur with musl
libc (used in Alpine Linux 3.17), on the Linux side the workaround could
be employed only if glibc 2.31+ is in use.
next prev parent reply other threads:[~2023-03-20 19:17 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-19 6:43 [PATCH 0/2] use gettimeofday for current time Paul Eggert
2023-03-19 6:43 ` [PATCH 1/2] git-compat-util: time_now " Paul Eggert
2023-03-19 6:43 ` [PATCH 2/2] git-compat-util: use gettimeofday " Paul Eggert
2023-03-19 19:34 ` Eric Wong
2023-03-20 16:33 ` Junio C Hamano
2023-03-20 17:01 ` Junio C Hamano
2023-03-20 19:00 ` Paul Eggert [this message]
2023-03-20 19:40 ` Junio C Hamano
2023-03-20 20:36 ` Taylor Blau
2023-03-20 20:35 ` Taylor Blau
2023-03-20 23:05 ` [PATCH v2] git-compat-util: use gettimeofday(2) for time(2) Junio C Hamano
2023-03-20 23:21 ` Paul Eggert
2023-03-21 16:20 ` Junio C Hamano
2023-03-21 17:44 ` Konstantin Khomoutov
2023-03-21 18:22 ` Junio C Hamano
2023-03-21 18:22 ` Jeff King
2023-03-21 19:06 ` Taylor Blau
2023-03-21 20:04 ` Junio C Hamano
2023-03-22 17: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=047178a8-ccf5-1cab-e670-8f1c64f9ca3c@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=e@80x24.org \
--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).