Greetings, wizards!
I've a bit of a puzzler here: the comparison of file ages as returned by stat() vs those given by ls.
1. "ls -Flu" on a given file returns an access date of 08 July, 2004.
2. "ls -Flc" gives a modification date on that file of 08 July, 2004.
3. stat() on the same file gives atime = 1089270507, mtime = 1070566444.
The interesting thing is that when I use the lesser of the times returned by stat() to calculate an age, the following is the result:
$stat_age = (today (in e-seconds) - min( atime, mtime ) + 43200)/86400
= (1092168958 - 1070566444 + 43200)/ 86400
= 250
So what? Well, atime should correlate to access date, and mtime to modification date, right? So how come a file a bit more than a month old (the dates & times were acquired on 10 August), according to ls, shows up as being a bit over EIGHT months old according to stat()?
Most important: how can I determine *which* of these ages is correct? I'm trying to create a file aging report to determine which files haven't been touched for a certain period of time. I have to know that I'm getting accurate INPUT if I want to have any hope of accurate OUTPUT--I'm trying to avoid a GIGO situation here. Any help in the resolution of this dilemma would be appreciated.
Thanks!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.