View Single Post
  #1 (permalink)  
Old August 25th, 2009, 12:06 AM
geek.shrek geek.shrek is offline
Authorized User
 
Join Date: Nov 2007
Location: , , .
Posts: 33
Thanks: 2
Thanked 0 Times in 0 Posts
Question File time stamp keep printing epoch

Hi,

I'm trying to get a file time stamp to record the file last modifed.
I would like to print as a real time, but I keep getting epoch time instead.

Code:
use Time::Local;

sub getTime
{
   my $filestat = (stat($myfile))[9];
   my $mystamp = scalar(localtime($filestat));

   print "File Stamp " . $mystamp;
}
It's printing "Thu Jan 1 10:00:00 1970"

Can someone tell me what did I do wrong here?

Thanks,
Reply With Quote