Re: sleep() for half a sec?
- Posted by ghaberek (admin) Feb 17, 2015
- 1327 views
jimcbrown said...
ghaberek said...
In short, make sure you are using the Euphoria 4.0 standard library routines in the std include directory.
But keep in mind that this only works for 4.0.0 or newer. Older versions did not support subsecond sleeping, even when calling the machine proc directly.
I always used this trick to get sub-second sleep() resolution in older versions of Euphoria. Works pretty well.
include misc.e global procedure sleep_ms( atom t ) atom t0 = time() + t while time() < t0 do sleep(0) end while end procedure atom t0, t1 t0 = time() sleep_ms( 0.25 ) t1 = time() - t0 printf( 1, "sleep_ms(0.25) = %0.2f sec\n", {t1} )
sleep_ms(0.25) = 0.25 sec-Greg