[CM] s7 does not measure seconds correctly

Rudolf Adamkovič salutis at me.com
Wed Nov 30 06:55:00 PST 2022


Observation:

  $ ./s7
  λ (current-second)
  0
  λ (current-second) ; about a minute later
  0

The definition in s7:

  (define (current-second) (floor (*s7* 'cpu-time)))

Executing `(*s7* 'cpu-time)' about 1 second apart:

  $ ./s7
  λ (*s7* 'cpu-time)
  0.009856
  λ (*s7* 'cpu-time)
  0.010111
  λ (*s7* 'cpu-time)
  0.010273

Configuration:

  macOS 13.0.1 (22A400), M1 CPU

Guile:

scheme@(guile-user)> (import (scheme time))
scheme@(guile-user)> (current-second)
$1 = 1669820061.212179
scheme@(guile-user)> (current-second) ; about 3 seconds later
$2 = 1669820064.625196

Rudy
-- 
"Programming reliably -- must be an activity of an undeniably
mathematical nature […] You see, mathematics is about thinking, and
doing mathematics is always trying to think as well as possible."
-- Edsger W. Dijkstra, 1981

Rudolf Adamkovič <salutis at me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia



More information about the Cmdist mailing list