This sounds like an XY Problem. The code you've given (besides the funky use of abs - I would just reverse the time and stat call), does not really check if the file is at least 20 minutes old - just that it was last modified at least 20 minutes ago. Given the general wonkiness of system clocks and finicky filesystems (nfs), this sounds like a recipe for a long night of sleepless debugging.

In the past, I've seen appoaches like this for trying to determine if some file has finished processing (ala ftp'ing a file). The general consensus in that regard is to always process under one file name convention (.file or file.part) and when done, rename it to something your follow on process looks for (file or file.done).

But then again ... maybe I'm just reading too much into the OP.

-derby

In reply to Re: Timestamp conditional by derby
in thread Timestamp conditional by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.