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,
> >
>
>
> ---
> This email has been checked for viruses by AVG.
> https://www.avg.com
>
> ----------------------------------------------------------------------
> 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