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?
You can use the time() function in Perl to get epoch time, i.e., the numbers of seconds that have elapsed since a given date, in Unix is January 1, 1970.
In computing, Unix time (also known as Epoch time, Posix time, seconds since the Epoch, Unix timestamp or UNIX Epoch time) is a system for describing a point in time. It is the number of seconds that have elapsed since the Unix epoch, excluding leap seconds. The Unix epoch is 00:00:00 UTC on 1 January 1970.
In a computing context, an epoch is the date and time relative to which a computer's clock and timestamp values are determined. The epoch traditionally corresponds to 0 hours, 0 minutes, and 0 seconds (00:00:00) Coordinated Universal Time (UTC) on a specific date, which varies from system to system.
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With