Caution: Time::HiRes returns a floating point number, but its precision is not necessarily very fine. For example, I noticed that on Windows, Time::HiRes::time() works in steps of around 55ms, or 1/18 of a second. That's the frequency of the system timer interrupt.