Last access time of specific file (TTY)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • danikdanik
    New Member
    • Aug 2006
    • 1

    Last access time of specific file (TTY)

    Hello all,

    The folowing code below returns the same last access time of the tty i am writing to for every loop iteration, what just can't be true. What am I doing wrong? Is there any other way to get the last access time? anything faster,as I need to get the info many times ?
    btw, what is the difference between last access time and last modifiaction time of a file?

    Code:
    my $curr_tty = `tty`;
    chomp($curr_tty);
    my $i = 1;
    while (1) {
            $curr_tty_time = (stat($curr_tty))[8];
            print "$i, $curr_tty_time\n";
            sleep 4;
            $i++;   
    }

    Thanks in advance for any help!
Working...