in reply to Time::HiRes sleep does not always work

What is the output of gettimeofday() on your laptop?

Based on reading the documentation, Time::HiRes is willing to try multiple strategies for each function. Your problem would make perfect sense if the only emulation of gettimeofday() that your laptop can find is the built-in time() function. However perl2exe compiles the C API call that Perl is looking for into the executable, and so that executable finds the API call that you're missing a library for.

Without a lot of research I can't tell you how to make sure that a useful form of gettimeofday() is properly found on your laptop.

  • Comment on Re: Time::HiRes sleep does not always work

Replies are listed 'Best First'.
Re^2: Time::HiRes sleep does not always work
by tone (Novice) on Aug 18, 2008 at 10:15 UTC

    The output for gettimeofday() is 121905424846875

    I thought that the problem could be caused by a missing function but Dells are running exactly the same Perl dir as me because he copied my Perl directory (so he didn't have to download all the modules)

      Hmph, pesky rounding keeps the decimal from being visible.

      Try printing gettimeofday() - time(). My suspicion is that they are exactly the same. And the cause is that at runtime Perl checks whether it can load the system gettimeofday function, and can't find it on one machine but can on another, leading to different results.

        I don't know how I ran the gettimeofday() when you originally asked but this time I'm getting a decimal. So if I run it now I get 1219149022.67188 and I get 0.671875 for gettimeofday() - time()