Epoch in Perl

view story

http://www.unix.com – Hi, Can anybody tell me how time is calculated in the below or what is actually being done here? Also can you explain in simple words about epoch time and why it is used? Quote: $d = strftime("%m-01-%Y",localtime(time)); @d = split /-/, $d; $epoch = timelocal(0, 0, 0, $d[1], $d[0]-1, $d[2]); ($sec, $min, $hr, $day, $stmth, $styr, $wday) = localtime($epoch-100); $styr=$styr+1900; $stmth=$stmth+1; $value = timelocal(0, 0, 0, 1, $d[0]-1, $d[2]); $start = $value-15768000; $seconds = $value-$start; #mstart $value=$value-1; $d="$stmth-$day-$styr"; (HowTos)