[ sisc-Bugs-1266449 ] srfi-19 current-time nanoseconds wrong by a factor of 100
"SourceForge.net" <[email protected]> Mon, 22 Aug 2005 11:36:06 -0700
| Newsgroups | gmane.comp.java.sisc.devel |
|---|---|
| Message-ID | <[email protected]> |
Bugs item #1266449, was opened at 2005-08-22 11:36
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=379534&aid=1266449&group_id=23735
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: John Russell (johnwrussell)
Assigned to: Nobody/Anonymous (nobody)
Summary: srfi-19 current-time nanoseconds wrong by a factor of 100
Initial Comment:
This bug is found in the SRFI-19 reference
implementation. It seems the bug stems from an
incorrect assumption that there are 10,000 nanoseconds
in a millisecond. Actually, there are 1,000,000
nanoseconds in a millisecond.
As a result of the bug, the value of (time-nanosecond
(current-time)) is 100 times too small. It should
range from 0 to 999,999,999. If you evaluate this
expression 10 times at approximately 100-millisecond
intervals, the value is always 9,999,999 or less.
Sample session:
$ sisc
SISC (1.11.2-rc) - main
#;> (require-library 'sisc/libs/srfi/srfi-19)
srfi-6
srfi-8
srfi-23
optional-args
srfi-19
#f
#;> (import srfi-19)
#;> (import threading)
#;> (for-each (lambda (x) (newline) (display
(time-nanosecond (current-time))) (sleep 100)) (iota 10)))
2680000
3680000
4680000
5680000
6690000
7690000
8690000
9690000
690000
1690000#;>
I believe that the following procedures in srfi-19.scm
need to be fixed. I don't know if this is an
exhaustive list...
(define (tm:current-time-utc)
(receive (seconds ms) (tm:get-time-of-day)
(make-time time-utc (* ms 10000) seconds )))
(define (tm:current-time-tai)
(receive (seconds ms) (tm:get-time-of-day)
(make-time time-tai
(* ms 10000)
(+ seconds (tm:leap-second-delta
seconds))
)))
(define (tm:current-time-monotonic)
(receive (seconds ms) (tm:get-time-of-day)
(make-time time-monotonic
(* ms 10000)
(+ seconds (tm:leap-second-delta
seconds))
)))
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=379534&aid=1266449&group_id=23735
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf