GNU bug report logs - #76227
SRFI 19's current-time-monotonic is not actually monotonic

Previous Next

Package: guile;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Wed, 12 Feb 2025 13:56:02 UTC

Severity: normal

To reply to this bug, email your comments to 76227 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#76227; Package guile. (Wed, 12 Feb 2025 13:56:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Wed, 12 Feb 2025 13:56:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: bug-guile <bug-guile <at> gnu.org>
Subject: SRFI 19's current-time-monotonic is not actually monotonic
Date: Wed, 12 Feb 2025 22:54:53 +0900
Hi,

Seen in srfi-19.scm:

--8<---------------cut here---------------start------------->8---
;; -- we define it to be the same as TAI.
;;    A different implementation of current-time-monotonic
;;    will require rewriting all of the time-monotonic converters,
;;    of course.

(define (current-time-monotonic)
  ;; Guile monotonic and TAI times are the same.
  (let ((tai (current-time-tai)))
    (make-time time-monotonic
               (time-nanosecond tai)
               (time-second tai))))
--8<---------------cut here---------------end--------------->8---

which as far as I can see uses CLOCK_REALTIME and not CLOCK_MONOTONIC as
it relies on gettimeofday(2), which has this note in its documentation:

    The time returned by gettimeofday() is affected by discontinuous  jumps
    in  the system time (e.g., if the system administrator manually changes
    the system time).  If you need a monotonically  increasing  clock,  see
    clock_gettime(2).

-- 
Thanks,
Maxim




This bug report was last modified 19 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.