[plt-scheme] Re: peek-bytes-avail!* caching results???

From: Chongkai Zhu (czhu at cs.utah.edu)
Date: Mon Mar 12 12:53:41 EDT 2007

I just checked the SRFI-19 implementation in DrScheme and
believes this is caused by a bug in it.

The guity part:

(define (tm:get-time-of-day)
  (values (current-seconds)
	  (abs (remainder (current-milliseconds) 1000))))

I will fix it.

Chongkai

----- Original Message ----- 
From: "Daniel Yoo" <dyoo at cs.wpi.edu>
To: "Corey Sweeney" <corey.sweeney at gmail.com>
Cc: "PLT-list" <plt-scheme at list.cs.brown.edu>
Sent: Monday, March 12, 2007 10:38 AM
Subject: Re: [plt-scheme] Re: peek-bytes-avail!* caching results???


>
>
> On Mon, 12 Mar 2007, Corey Sweeney wrote:
>
>> I found my issue.  peek-bytes-avail!* works fine.  The issue was that
>> the system clock ran the opposite way then I would have expected.
>> example:
>>
>>>  (require (lib "19.ss" "srfi"))
>>>  (time-nanosecond (current-time))(time-nanosecond
>>>  (current-time))(time-nanosecond (current-time))
>> 2940000
>> 2850000
>> 2780000
>
>
> Hi Corey,
>
> Wait: time is constructed from both seconds AND nanoseconds.  I think you 
> wanted:
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> (require (lib "19.ss" "srfi"))
>
> (define (get-nanoseconds)
>   (local
>       ((define t (current-time))
>        (define secs (time-second t))
>        (define nanosecs (time-nanosecond t)))
>     (+ (* (expt 10 9) secs)
>        nanosecs)))
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>
> Best of wishes!
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 



Posted on the users mailing list.