Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

time

Returns the number of seconds since the Unix epoch.

Returns the current time as a non-negative integer representing whole seconds elapsed since 1970-01-01 00:00:00 UTC (the Unix epoch).

If Time::HiRes::time has been imported into the current package (overriding the builtin), this op dispatches to the high-resolution version which returns a floating-point value with microsecond precision. The CORE::time form (SPECIAL flag set) always uses the integer builtin, bypassing any override.

Synopsis

my $now = time();             # e.g. 1704067200
my $core = CORE::time;        # always integer, bypasses overrides
# with: use Time::HiRes qw(time);
my $hires = time();           # e.g. 1704067200.123456

See Also

localtime, gmtime, Time::HiRes