Guidance
指路人
g.yi.org
Guidance Forums / Reginald Rexx / BUG: SLEEP Function and fractions of a seconds

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. BUG: SLEEP Function and fractions of a seconds
#11015
Posted by: PeterJ 2007-07-12 22:19:11 Last edited by: PeterJ 2007-07-12 22:20:28 (Total edited 1 time)
Minor problem!
It seems SLEEP doesn't process fractions of second properly. Try this rexx:

DO i=1 TO 15 
   x=TIME('R')	
   wait=i/10
   SLEEP(wait)
   elp=TIME('E')
   SAY 'should wait: 'wait 'waited: 'elp
END

you find that fractions of a second are not working properly.

As I said, low priority!

Peter
Message2.
#11016
Posted by: Jeff Glatt 2007-07-12 23:35:02
It should be noted that, when you get down to milliseconds on a Windows running computer, it can be inprecise. Windows rounds off the request a bit. Plus, the timing reference you're using is REXX's TIME() function which itself is not a precision timer at all.

So, I don't think what you're seeing is that odd or unexpected.
Message3.
#11018
Posted by: PeterJ 2007-07-12 23:59:36 Last edited by: PeterJ 2007-07-13 00:47:48 (Total edited 2 times)
This is what I get, tested in an AMD, INTEL enviroment:
should wait: 0.1 waited: .016000
should wait: 0.2 waited: .000000
should wait: 0.3 waited: .000000
should wait: 0.4 waited: .015000
should wait: 0.5 waited: .000000
should wait: 0.6 waited: .000000
should wait: 0.7 waited: .016000
should wait: 0.8 waited: .000000
should wait: 0.9 waited: .015000
should wait: 1 waited: 1.000000
should wait: 1.1 waited: 1.000000
should wait: 1.2 waited: 1.000000
should wait: 1.3 waited: 1.016000
should wait: 1.4 waited: 1.000000
should wait: 1.5 waited: 1.000000

which shows, that the fraction of a second seem to be always zero, or sometimes 0.016, but never 1,2, 3, ... tenth of a second.
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Tue 2024-10-8  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0