in reply to converting Time::HiRes
You need to re-read the docs. This line of code:
my $t0 = [gettimeofday];
Is putting two values (seconds and microseconds) into an anonymous array and assigning a reference to that array to $t0. You then pass that reference to localtime() and get strange results.