Perl Programming/Keywords/time

Previous: tied Keywords Next: times

The time keyword

edit

time returns the number of non-leap seconds since the beginning of the epoch, which is on most systems 1970-01-01 00:00:00 UTC.

Syntax

edit
  time

Examples

edit
  The code
$time = time;

print $time . " s, " . $time/60 . " min, " . $time/3600 . " h\n";
print $time/86400 . " d, " . $time/2629743.84 . " months, " . $time/31556926.08 . " y\n";
returns on Windows something like:
1424097849 s, 23734964.15 min, 395582.735833333 h
16482.6139930556 d, 541.534816942475 months, 45.1279014118729 y

See also

edit
gmtime localtime time times utime
Previous: tied Keywords Next: times