costas has asked for the wisdom of the Perl Monks concerning the following question:
$time gave the present epoch time of 1010233107#split date into seperate vars my($day, $month, $mday, $time, $year) = split(" ", $datetime); my($timeh, $timem, $times) = split(':', $time); #this function calculates the number of seconds that have passed since + Midnight, January 1, 1970 my $time = timegm($times,$timem,$timeh,$mday,$month,$year);
Note that oin the above code i have printed the localtime mod time as well as the epoch mod time.find (\&checkfile, "/home/costas"); sub checkfile { my @stats = stat $_; $fileage = $time-$stats[9]; my @filetime = localtime($stats[9]); my $year = $filetime[5]+1900; print "$File::Find::name Epoch mod : $stats[9], LT mo +d $filetime[2]:$filetime[1]:$filetime[0] $filetime[4]/$year, Age o +f + file : $fileage <br>"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Epoch mod time for files
by steves (Curate) on Mar 05, 2002 at 15:38 UTC | |
|
Re: Epoch mod time for files
by Rhose (Priest) on Mar 05, 2002 at 15:38 UTC | |
|
Re: Epoch mod time for files
by mpeppler (Vicar) on Mar 05, 2002 at 15:39 UTC | |
|
Re: Epoch mod time for files
by webadept (Pilgrim) on Mar 05, 2002 at 17:13 UTC | |
|
Re: Epoch mod time for files
by Anonymous Monk on Mar 05, 2002 at 16:56 UTC | |
|
Re: Epoch mod time for files
by costas (Scribe) on Mar 06, 2002 at 09:49 UTC |