in reply to Giving birth with perl

You could use Time::HiRes, so you can get a finer than 1 second precision for the interval! (up to 55ms, on Windows, the clock is updated 18 times per second)

Replies are listed 'Best First'.
Re^2: Giving birth with perl
by jasonk (Parson) on Jul 29, 2006 at 15:03 UTC

    I could, but my wife doesn't have resolution that high. It takes her a second or two to tell me it's started or stopped anyway. :)


    We're not surrounded, we're in a target-rich environment!
Re^2: Giving birth with perl
by ikegami (Patriarch) on Jul 31, 2006 at 23:03 UTC
    I thought that got fixed? Changes supports my memory:
    1.53 [2003-12-30] - Windows: higher resolution time() by using the Windows performance counter API, from Jan Dubois and Anton Shcherbinin. The exact new higher resolution depends on the hardware, but it should be quite a bit better than using the basic Windows timers.

    Here's some code that will test this. I only have version 1.2, so I'm still using the lower res timer.

    use Time::HiRes qw( time sleep ); my @times = map { time } 0..200; #my @times = map { sleep(0.001); time } 0..200; my @time_diffs = map { $times[$_] - $times[$_-1] } 1..$#times; $, = "\n"; $\ = "\n"; print @time_diffs;