[CLUE-Tech] timestamps (thanks jeff!!)

Dave Price davep at support-one.com
Sun Mar 18 09:47:10 MST 2001


Thanks for the advice ...

At 08:52 AM 03/18/2001 -0700, you wrote:
<snip>

Yes.  time_t is the C language structure to hold a time stamp.

>PERL supports the time_t time stamp natively.  If you are looking at files, I
>often use the last modified time.  I use the 'stat()' or 'lstat()' built-in
>PERL function.
>
>Here is a simple example.  Both $ftime and $now will contain large integers
>that represent the number of seconds since the epoch.  So, you can reliably
>compare their timestamps.
>
>I take the ninth element from the array returned by stat because (check
>perldoc page on stat) it is the mtime of the file (i.e., the last
>modification time),
>
>my $ftime = stat( '/home/jccann/bob.txt' ) [ 9 ];
>my $now = time();
>
>if ( $ftime < $now ) {
>         print 'my file is older than now';
>}
>
>You also can also take a formatted string and build a timestamp.  I haven't
>done this in PERL.  Probably you want to check the PERL cookbook or CPAN for
>an example.




More information about the clue-tech mailing list