1. sleep() standard function
- Posted by Jeremy Peterson <ptl99 at hotmail.com> Aug 18, 2006
- 508 views
- Last edited Aug 19, 2006
The sleep function included with Euphoria can only handle integer values. Simply changing integer to atom in the function definition allows it to handle fractional values as well. Rob, d'you think you could change this for 3.0? Thus saving anyone who needs to use fractional times the time of manually changing it. Jeremy
2. Re: sleep() standard function
- Posted by D. Newhall <derek_newhall at yahoo.com> Aug 18, 2006
- 493 views
- Last edited Aug 19, 2006
Jeremy Peterson wrote: > > The sleep function included with Euphoria can only handle integer values. > > Simply changing integer to atom in the function definition allows it to handle > fractional values as well. > > Rob, d'you think you could change this for 3.0? > Thus saving anyone who needs to use fractional times the time of manually > changing > it. > > Jeremy I agree. I ran into this problem recently too. In the meantime I've been using this procedure: -- Waits for a specific amount of time passed to it in seconds global procedure wait(atom seconds) atom start_time start_time = time() if integer(seconds) then sleep(seconds) else -- a floating point number while time() - start_time < seconds do -- Nothing -- Busy loop until `seconds` have elapsed end while end if end procedure -- wait
3. Re: sleep() standard function
- Posted by "Kat" <kat12 at coosahs.net> Aug 18, 2006
- 511 views
- Last edited Aug 19, 2006
> > > posted by: Jeremy Peterson <ptl99 at hotmail.com> > > The sleep function included with Euphoria can only handle integer > values. > > Simply changing integer to atom in the function definition allows it > to handle fractional values as well. > > Rob, d'you think you could change this for 3.0? > Thus saving anyone who needs to use fractional times the time of > manually changing it. I already changed it to allow for zero. Zero doesn't sleep(), really, but it does hand the remainder of the application's available timeslice back to window's multitasker timeslicer. Kat
4. Re: sleep() standard function
- Posted by Robert Craig <rds at RapidEuphoria.com> Aug 19, 2006
- 508 views
Jeremy Peterson wrote: > The sleep function included with Euphoria can only handle integer values. > > Simply changing integer to atom in the function definition allows it to handle > fractional values as well. Yeah, it handles fractional values by rounding to an integer. > Rob, d'you think you could change this for 3.0? > Thus saving anyone who needs to use fractional times the time of manually > changing > it. It's something I'm looking into. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com
5. Re: sleep() standard function
- Posted by Al Getz <Xaxo at aol.com> Aug 19, 2006
- 533 views
Hi, I end up using Sleep() in the WinAPI too. I think Watcom's sleep() takes only integer values doesnt it? One thing i wouldnt like to see, and that is a new sleep() function that uses a simple loop to waste time, because that uses up all the processor time. Perhaps you could also try a sleep function with resolution down to a tenth of one second by creating a new thread that does this. Tenth of a second resolution isnt too bad. Take care, Al E boa sorte com sua programacao Euphoria! My bumper sticker: "I brake for LED's" From "Black Knight": "I can live with losing the good fight, but i can not live without fighting it". "Well on second thought, maybe not."