It's easy to get Epoch-Seconds (timestamp) in perl:
time
But what's with milliseconds? The most effective way seems to be time*1000, but that's not as accurate as I want it to be. Any good hints except for the long terms documented @perldoc?
It's easy to get Epoch-Seconds (timestamp) in perl:
time
But what's with milliseconds? The most effective way seems to be time*1000, but that's not as accurate as I want it to be. Any good hints except for the long terms documented @perldoc?
The Time::HiRes module has a drop-in replacement for time
$ perl -E 'say time'
1298827929
$ perl -MTime::HiRes=time -E 'say time'
1298827932.67446
You can read more in the perl FAQ
perldoc -q "How can I measure time under a second"
A real world example would be:
use Time::HiRes qw(gettimeofday);
print gettimeofday;
perl -MTime::HiRes=time -e 'print time;'
For Perl: v5.8.4 built for SunOS (sun4-solaris-64int), oylenshpeegul's answer needs to be modified.