Delay works fine (and as documented) on Windows:
   6!:2 '6!:3 ]2.5'
2.49987

confirmed in j602 and 701.

Marshall

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Ian Clark
Sent: Tuesday, May 31, 2011 12:28 AM
To: Programming forum
Subject: Re: [Jprogramming] Delay execution for y seconds rounds its argument 
to whole seconds

Thanks, Bill. Yes, I've resorted to the old-fashioned method of a tight loop.
If that lets me down, I'll use the 1-shot timer I'm using elsewhere.

> I think this is a feature as a result of the feature of underlying o/s sleep 
> api.

But: http://www.jsoftware.com/help/dictionary/dx006.htm  actually says:
 6!:3 y         Delay. Delay execution for y seconds. For example, 6!:3 (2.5)
...which suggests to me it's meant to be used (meaningfully) with fractional 
seconds.



On Tue, May 31, 2011 at 4:33 AM, bill lam <[email protected]> wrote:
> If you can afford full cpu loading, try,
>
> foo=: 3 : 0
> a=. 6!:1''
> while. y> b=.a-~6!:1'' do. end.
> y,b
> )
>   foo 0.001
> 0.001 0.00100398
>
> Втр, 31 Май 2011, Ian Clark писал(а):
>> I notice on my Mac that "Delay execution for y seconds" (3!:6 y) 
>> rounds its argument to whole seconds...
>>
>>    timer '6!:3 ]0.49'
>> 2.71606e_5
>>    timer '6!:3 ]0.5'
>> 1
>>    timer '6!:3 ]2.49'
>> 1.99996
>>    timer '6!:3 ]2.5'
>> 2.99993
>>
>> Is this behaviour replicated on Windows or other non-Mac platforms? 
>> Is it a bug or a feature?
>>
>> It would be nice to have a 0.1 sec delay, which I can't seem to get.
>> ---------------------------------------------------------------------
>> - For information about J forums see 
>> http://www.jsoftware.com/forums.htm
>
> --
> regards,
> ====================================================
> GPG key 1024D/4434BAB3 2008-08-24
> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to