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

Re: [MacPerl] Modification date



Carl Johan Berglund writes:
|At 00.12 +0200 98-08-30, Brian "L." Matthews wrote:
|>|>Does anyone know how to get the modification date of
|>|>a file using MacPerl?
|>|$mod_date = $^T - 86400*(-M $filename);
|>Maybe I'm missing something obvious here, but what's wrong with stat?
|I prefer -M, because stat returns a lot of
|stats about the file, and when I just want one of them, I'll have to throw
|away the rest of them. I prefer getting what I want to getting more and
|throwing most of it away...

Guess what -M does--it stats the file and throws away all except the
mod date. In addition, it also has to do the inverse of the above
calculation, so what the above is really doing is:

$mod_date = $^T - 86400 * (($^T - (stat $filename)[9]) / 86400);

So using -M to get the mod date is slower than stat, and less precise.

Brian

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