This function returns number of non-leap seconds since 1.1.1970, UTC. Useful for feeding the value to other functions or to determine time differences.
#!/usr/bin/perl # $timeStart = time(); sleep 3; # replace this by the piece of code you are interested in $timeTotal = time() - $timeStart; print " Total time $timeTotal \n"; exit 0;
The time() output may also be fed into localtime.
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isday) = localtime time();