Eric Stephenson wrote:
> 
> Hi,
> 
> I am using the following to try and get the file date and time but for some reason 
>am not getting what I am expecting.
> 
> Here is the snippet of code:
> 
> $file = "install.log";
> $time = (stat("$file"))[10];
> $ltime = local($time);
> 
> print "$ltime\n";
> 
> And what I am getting out:
> 
> Wed Dec 31 19:00:00 1969
> 
> Even though I know the file was created and access on May 24, 00.
> 
> What is going on?

It appears that stat is returning '0' for inode change time (Dec 31
19:00:00 1969 is the epoch, Jan 1 0:00:00 1970, adjusted for EDT).

Try adding some error handling code:

my $file = "install.log";
my @status = stat($file) or die "error accessing $file: $!";

print scalar(localtime($status[0])), "\n";


Also, check the entry for 'install.log' in Explorer and/or DOS to make
sure that the inode change time is indeed set.


HTH,
Ian


-- 
99 little bugs in the code, 99 bugs in the code.
Fix one bug, compile again, 100 little bugs in the code.
100 little bugs in the code, 100 bugs in the code.
Fix one bug, compile again, 101 little bugs in the code...

---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
         [EMAIL PROTECTED]

Reply via email to