Time args to SELECT and SET-FILE-TIMES can now be reals.

This commit is contained in:
shivers 1995-10-28 22:07:16 +00:00
parent 05df0d4773
commit dce0dc36cd
3 changed files with 29 additions and 11 deletions

View File

@ -33,7 +33,16 @@
(define (select!/copyback/errno read-vec write-vec
exception-vec . maybe-timeout)
(let ((timeout (optional-arg maybe-timeout #f))
(let ((timeout (and (pair? maybe-timeout)
(if (pair? (cdr maybe-timeout))
(apply error "Too many arguments"
select!/copyback/errno
read-vec write-vec exception-vec
maybe-timeout)
(real->exact-integer (check-arg real?
(car maybe-timeout)
select!/copyback/errno)))))
(vec-ok? (lambda (v)
(vector-every? (lambda (elt)
(or (and (integer? elt) (>= elt 0))
@ -86,7 +95,16 @@
(values nr nw ne))))
(define (select!/errno read-vec write-vec exception-vec . maybe-timeout)
(let ((timeout (optional-arg maybe-timeout #f))
(let ((timeout (and (pair? maybe-timeout)
(if (pair? (cdr maybe-timeout))
(apply error "Too many arguments"
select!/copyback/errno
read-vec write-vec exception-vec
maybe-timeout)
(real->exact-integer (check-arg real?
(car maybe-timeout)
select!/copyback/errno)))))
(vec-ok? (lambda (v)
(vector-every? (lambda (elt)
(or (and (integer? elt) (>= elt 0))

View File

@ -157,7 +157,7 @@
(define (date . args) ; Optional args [time zone]
(let ((time (if (pair? args)
(integerize-time (check-arg real? (car args) date))
(real->exact-integer (check-arg real? (car args) date))
(time)))
(zone (check-arg time-zone?
(and (pair? args) (optional-arg (cdr args) #f))
@ -219,7 +219,7 @@
;;;
;(define (utc-offset . args) ; Optional args [time tz]
; (let ((tim (if (pair? args)
; (integerize-time (check-arg real? (car args) utc-offset))
; (real->exact-integer (check-arg real? (car args) utc-offset))
; (time)))
; (tz (and (pair? args)
; (check-arg time-zone? (optional-arg (cdr args) #f) utc-offset))))
@ -233,7 +233,7 @@
; (if (integer? tz)
; (deintegerize-time-zone tz)
; (let* ((summer? (if (pair? args) (car args) (time)))
; (summer? (if (real? summer?) (integerize-time summer?) summer?)))
; (summer? (if (real? summer?) (real->exact-integer summer?) summer?)))
; (receive (err zone) (%time-zone/errno summer? tz)
; (if err (errno-error err time-zone summer? tz)
; zone))))))
@ -297,9 +297,3 @@
sign (two-digits h) (two-digits m)))
(format #f "~a~a~a:~a:~a" ; name+hh:mm:ss
sign (two-digits h) (two-digits m) (two-digits s)))))))
;;; (floor x), as an exact int.
(define (integerize-time x)
(let ((f (floor x)))
(if (inexact? f) (inexact->exact f) f)))

View File

@ -209,3 +209,9 @@
name
maybe-preferred-msg)))
(apply proc args))))
(define (real->exact-integer x)
(let ((f (round x)))
(if (inexact? f) (inexact->exact f) f)))