From: Paul Eggert <eggert@cs.ucla.edu>
To: git@vger.kernel.org
Cc: Paul Eggert <eggert@cs.ucla.edu>
Subject: [PATCH 0/2] use gettimeofday for current time
Date: Sat, 18 Mar 2023 23:43:51 -0700 [thread overview]
Message-ID: <20230319064353.686226-1-eggert@cs.ucla.edu> (raw)
In recent GNU/Linux versions on rare occasions the 'time' function
returns a value that is one second less than the seconds component of
the timestamp that would be returned by gettimeofday, clock_gettime
with CLOCK_REALTIME, 'stat' on a recently modified file, etc.
If a program calls both 'time' and any of these other functions, the
system clock will appear to jump backwards by a second temporarily.
This can lead to confusing or inconsistent output.
A simple workaround for Git is to use 'gettimeofday' instead of
'time'. Although other options are possible (see the commit message
of patch 0002), simplest is probably best.
Paul Eggert (2):
git-compat-util: time_now for current time
git-compat-util: use gettimeofday for current time
archive.c | 2 +-
blame.c | 2 +-
builtin/bugreport.c | 2 +-
builtin/credential-cache--daemon.c | 4 ++--
builtin/diagnose.c | 2 +-
builtin/fast-import.c | 2 +-
builtin/fsmonitor--daemon.c | 4 ++--
builtin/gc.c | 2 +-
builtin/log.c | 2 +-
builtin/receive-pack.c | 2 +-
builtin/reflog.c | 2 +-
commit-graph.c | 4 ++--
compat/nedmalloc/malloc.c.h | 2 +-
credential.c | 4 ++--
date.c | 6 +++---
git-compat-util.h | 8 ++++++++
http-backend.c | 2 +-
http-push.c | 6 +++---
rerere.c | 2 +-
run-command.c | 4 ++--
t/helper/test-chmtime.c | 4 ++--
t/helper/test-simple-ipc.c | 4 ++--
22 files changed, 40 insertions(+), 32 deletions(-)
--
2.39.2
next reply other threads:[~2023-03-19 6:53 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-19 6:43 Paul Eggert [this message]
2023-03-19 6:43 ` [PATCH 1/2] git-compat-util: time_now for current time 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
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230319064353.686226-1-eggert@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--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.
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 NNTP newsgroup(s).