in reply to Re^2: Time::HiRes sleep does not always work
in thread Time::HiRes sleep does not always work

That means while perl was busy printing 100 time stamps there was absolutely no change in the time stamp itself. On my maschine every few (4 or 5) values the time stamp changed, but only the minimal step the floating point number could show:

1219059879.53406 1219059879.53407 1219059879.53407 1219059879.53407 1219059879.53407 1219059879.53408 1219059879.53408 1219059879.53408 1219059879.53408 1219059879.53408 1219059879.53408 1219059879.53408 1219059879.53409 1219059879.53409 1219059879.53409 1219059879.53409

That means on my machine there really is a hires timer operating as fast or faster than the resolution of the number I get back. On your machine the loop is either at least 20 times faster than on my machine (very unlikely) or your timer is at least 20 times slower.

Change the 100 in the script to 1000 or more, at least until you see more than one change in the numbers. The difference is the resolution at which your timer works.

For example, if the difference is 0.01, then your timer ticks have a resolution of only 1/100 seconds. My machine above has a resolution of at least 1/50000, i.e. under 20 microseconds

Replies are listed 'Best First'.
Re^4: Time::HiRes sleep does not always work
by tone (Novice) on Aug 19, 2008 at 12:25 UTC

    I changed the 100 in the script and I only get different time at about 9000.

    I'm really starting to think that I should keep this script to test any machine I plan on buying in the future