In
Time::Hires, there are two simple ways to measure time intervals, namely
use Time::HiRes qw(gettimeofday tv_interval);
$t0 = [gettimeofday];
$elapsed = tv_interval($t0)
or
use Time::HiRes qw(time);
$t0 = time;
$elapsed = time - $t0;
Is one of these two methods preferrable, considering accuracy and performance? As both
gettimeofday and
time provide accuracy up to microseconds, it seems to me that the accuracy of both time intervals are equivalent.
Thank you for your help!
Update: added
use Time::HiRes to the code above.