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.
Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon