In the beta release -
6!:2 'delay 10#0.2'
5.2e_5
6!:2 'delay 1'
1.000993
JVERSION
Engine: j807/j64/darwin
Beta-g: commercial/2018-07-02T12:56:14
Library: 8.07.16
Platform: Darwin 64
Installer: J807 install
InstallPath: /applications/j64-807
Contact: www.jsoftware.com
6!:2 'delay 1 2 0.3'
3.007271
JVERSION
Engine: j807/j64nonavx/linux
Beta-e: commercial/2018-05-25T11:59:04
Library: 8.07.15
Platform: Linux 64
Installer: J807 install
InstallPath: /usr/local/lib/j64-807
Contact: www.jsoftware.com
6!:2 'delay 1 2 0.3'
3.000745
Which seems to confirm that fractional parts are being ignored. In non-Windows
systems.
> On 2018Jul 3, at 13:43, Raul Miller <[email protected]> wrote:
>
> I expect it to work ok on Windows, but not other systems.
>
> 6!:2 'delay 10#0.2'
> 0.000107
> 6!:2 'delay 1'
> 1.00001
> JVERSION
> Engine: j806/j64/darwin
> Release: commercial/2017-11-06T10:20:33
> Library: 8.06.09
> Qt IDE: 1.6.1/5.6.3
> Platform: Darwin 64
> Installer: J806 install
> InstallPath: /users/rauldmiller/applications/j64-806
> Contact: www.jsoftware.com
>
> Thanks,
>
> --
> Raul
> On Tue, Jul 3, 2018 at 4:00 PM Henry Rich <[email protected]> wrote:
>>
>> This works correctly for me on Windows. The code for SYS_MACINTOSH
>> waits for (60*+/y) TickCount ticks; other platforms do sleep(1000) for
>> (<. +/ y) repetitions, followed by one final sleep to get the remnant of
>> time.
>>
>> Can it be that your OS is using the Windows code but sleep() is
>> returning fast? If so, if you just do
>>
>> 6!:3 ] 10
>>
>> you should see it return very quickly.
>>
>> Henry Rich
>>
>> On 7/3/2018 2:12 PM, Raul Miller wrote:
>>> http://www.jsoftware.com/help/dictionary/dx006.htm says:
>>>
>>> 6!:3 y Delay. Delay execution for y seconds. For example, 6!:3 (2.5)
>>>
>>> but today I ran into an example where that did not seem to be what it was
>>> doing.
>>>
>>> Rather than go into the full complexity of that example, let's try
>>> doing a two second delay in ten steps:
>>>
>>> delay=: 6!:3"0
>>> timespacex 'delay 10#0.2'
>>> 3.6e_5 2432
>>>
>>> Pretty fast right? Two seconds compressed into less than a millisecond...
>>>
>>> My guess is that J's using an api mechanism (sleep) which only
>>> supports integer seconds and it's discarding the fractions.
>>>
>>> As an alternative:
>>>
>>> Linux/OSX/etc.: nanosleep
>>> Windows: sleep (has millisecond precision)
>>>
>>> (In other words, all I really needed to do to fix this problem was
>>> switch operating systems.)
>>>
>>> Thanks,
>>>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm