SRFI 19's current-time-monotonic is not actually monotonic

  • Open
  • quality assurance status badge
Details
One participant
  • Maxim Cournoyer
Owner
unassigned
Submitted by
Maxim Cournoyer
Severity
normal

Debbugs page

Maxim Cournoyer wrote 1 months ago
(name . bug-guile)(address . bug-guile@gnu.org)
87zfirp8sy.fsf@gmail.com
Hi,

Seen in srfi-19.scm:

Toggle snippet (13 lines)
;; -- 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))))

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
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 76227@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 76227
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help