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

Re: [MacPerl] XFCN XCMD & MacPerl how can I get a ls -lR style file list and then some?



hgun@ais.net (H-Gun Labs Chicago) writes:
}
}   I think I've found most of what I need with Inside Macintosh ..except
}turning the numbers produced from these values into human readable dates??
}
}$creation = $has->{ioFlCrDat};
}$modified = $has->{ioFlMdDat};

They are the number of seconds since Jan 1 1904, the Mac beginning of time.
You should be able to just use localtime() to convert them, but
unfortunately, you run into some Perl 5.002 integer bugs.  If you just
print them, you'll notice that they're interpreted as signed ints rather
than unsigned ints, as they should be.   Here's hoping that they work
correctly in Matthias' 5.004 port.

You can get around the problem by using pack and unpack:

#!perl

use Mac::Files;

$file = "The Black Pits:Desktop Folder:Clippings";
$has = FSpGetCatInfo($file);

$creation = pack("N",$has->{ioFlCrDat});
$modified = pack("N",$has->{ioFlMdDat});
$temp = unpack("N",$creation);
$temp2 = unpack("N",$modified);
print "$temp, $temp2\n";
($sec1,$min1,$hour1,$mday1,$mon1,$year1) = localtime($temp);
$mon1++;
($sec2,$min2,$hour2,$mday2,$mon2,$year2) = localtime($temp2);
$mon2++;
#
#using the God given, proper way to write dates :-)
#
print "I was created on $mon1/$mday1/$year1 at $hour1:$min1:$sec1\n";
print "and last modified on $mon2/$mday2/$year2 at $hour2:$min2:$sec2\n";

}
}
}Adrian
}
}
}
}***** Want to unsubscribe from this list?
}***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch


---
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693, Greenbelt, MD 20771
schinder@pjstoaster.pg.md.us



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch