In the Perl programming language has a built-in function
This function returns an integer — the number of seconds since
the beginning of the era. Almost all modern systems
the start time is zero seconds, zero minutes, zero hours on the first of January 1970
in the time zone UTC (
1970-01-01T00:00:00Z). This number is often called
Here is an example of using this feature:
At the time of this writing, the program brought the number
1577113985that corresponds to the date
time() does not accept arguments. If you try to give her an argument, it will error:
syntax error at script.pl line 3, near "(8"
Execution of script.pl aborted due to compilation errors.
CORE::time()) returns the number of whole seconds
since the beginning of the era. If accuracy to the second is not enough, you can use
Time::HiRes::time(), which returns the number of float number of seconds
since the beginning of the era.
Example program which shows the use of two of these functions:
use feature qw(say);
Here is the output of the command
perldoc -f time:
time Returns the number of non-leap seconds since whatever time the
system considers to be the epoch, suitable for feeding to
"gmtime" and "localtime". On most systems the epoch is
00:00:00 UTC, January 1, 1970; a prominent exception being Mac
OS Classic which uses 00:00:00, January 1, 1904 in the current
local time zone for its epoch.
For measuring time in better granularity than one second, use
the Time::HiRes module from Perl 5.8 onwards (or from CPAN
before then), or, if you have gettimeofday(2), you may be able
to use the "syscall" interface of Perl. See perlfaq8 for
For date and time processing look at the many related modules
on CPAN. For a comprehensive date and time representation look
at the DateTime module.