public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "eggert at cs dot ucla.edu" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug time/30200] time sometimes appears to go backwards
Date: Sun, 19 Mar 2023 23:43:45 +0000	[thread overview]
Message-ID: <bug-30200-131-Up2ZxhL0qr@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-30200-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=30200

eggert at cs dot ucla.edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eggert at cs dot ucla.edu

--- Comment #11 from eggert at cs dot ucla.edu ---
(In reply to Florian Weimer from comment #10)
> Is this actually causing application problems...?

In theory any sequence of timestamps is something that a (perverse) sysadmin
could inflict on the user by constantly futzing with the system clock, and
hence applications that generate out-of-order timestamps are allowed by POSIX.

In practice out-of-order timestamps are problematic. Users will likely be
confused, for example, if a log of a thread's actions contain out-of-order
timestamps even when the system clock was not reset.

I looked at a few applications.

* Git can issue out-of-order timestamps. It's complicated enough that I judged
it simpler to fix the problem than worry about how serious it is, and filed a
proposed patch to do that
<https://lore.kernel.org/git/20230319064353.686226-1-eggert@cs.ucla.edu/T/#u>.

* GNU Make can issue out-of-order timestamps in a debugging log - not a serious
problem but it could be annoying. I filed a proposed patch
<https://lists.gnu.org/r/bug-make/2023-03/msg00081.html>.

* Gnulib can generate out-of-order timestamps when parsing old-fashioned time
strings, causing glitches in Gnulib-using commands like 'touch 01010000 file'.
This is not serious (hardly anybody uses those old POSIX-specified strings that
do not specify year numbers) and I don't know whether it's a POSIX violation. I
fixed that problem <https://lists.gnu.org/r/bug-gnulib/2023-03/msg00028.html>
and the fix should propagate into future releases of Coreutils etc.

* GNU Emacs proper does not have the problem with Glibc (it may have it with
MS-Windows but that’s out of scope here). One Emacs auxiliary program
‘movemail’ may have the issue since it does call ‘time’. I haven’t investigated
further.

The result of this brief investigation:

* There are problems.

* Effects observed so far are small (e.g., logs out of order).

* GNU Make (my first worry, due to its extensive use of timestamps) seems to be
mostly OK.

* Any big effects are surely either rare, or hard to trace back to the problem
source (or both); if big effects were common and easily traced back, we’d know
already.

As an application developer I’d rather see ‘time’ fixed to match ‘gettimeofday’
/ CLOCK_REALTIME / etc., as I worry that there might be larger, rare effects
that this little survey didn’t catch.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2023-03-19 23:43 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-05 17:21 [Bug time/30200] New: " bruno at clisp dot org
2023-03-05 17:22 ` [Bug time/30200] " bruno at clisp dot org
2023-03-05 17:23 ` bruno at clisp dot org
2023-03-05 17:55 ` girish946 at gmail dot com
2023-03-05 18:28 ` schwab@linux-m68k.org
2023-03-05 18:58 ` schwab@linux-m68k.org
2023-03-05 19:04 ` bruno at clisp dot org
2023-03-06 12:15 ` adhemerval.zanella at linaro dot org
2023-03-06 12:25 ` fweimer at redhat dot com
2023-03-06 12:45 ` bruno at clisp dot org
2023-03-06 13:08 ` adhemerval.zanella at linaro dot org
2023-03-06 13:14 ` fweimer at redhat dot com
2023-03-19 23:43 ` eggert at cs dot ucla.edu [this message]
2023-03-21  4:18 ` sam at gentoo dot org
2023-03-21 15:06 ` adhemerval.zanella at linaro dot org
2023-03-21 15:29 ` bruno at clisp dot org
2023-03-21 16:02 ` adhemerval.zanella at linaro dot org
2023-03-21 20:00 ` bruno at clisp dot org
2023-03-21 20:03 ` adhemerval.zanella at linaro dot org
2023-03-21 20:25 ` fw at deneb dot enyo.de
2023-03-21 20:41 ` adhemerval.zanella at linaro dot org

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=bug-30200-131-Up2ZxhL0qr@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).