[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Formatting Mac File Modification Time



In a MacPerl program to do some specialized file cataloging, I have

$size = -s $pathname;
$info = FSpGetCatInfo($pathname);
$finfo = $info->{ioFlFndrInfo};
$cDate = $info->{ioDrMdDat};
$mDate = $info->{ioFlMdDat};
$creator = $finfo->{fdCreator};
$type = $finfo->{fdType};
	
(some of above code stolen from one of Matthias's tests).

My question relates to how to format the creation and modification times
$cDate and $mDate.  Using localtime($mDate) doesn't give the right
value.

local($sec, $min, $hour, $mday, $mon, $year,
$wday, $yday, $isdst) = localtime($mDate);
printf "%02d/%02d/%02d\n", $year, $mon+1, $mday+1;	

prints 04/01/02 instead of 97/01/37 as desired.

While I'm posting ...  Is the file size also available in the $info or
$finfo structures?  i couldn't find where this was documented.

----------------------------------------------------
Barry Wolman			barry@transarc.com
Transarc Corporation		412/338-4364 (voice)
707 Grant Street		412/338-4404 (fax)
Pittsburgh, PA 15219