public Method

File.atime

file.atime     time

Returns the last access time (a Time object)

for <i>file</i>, or epoch if <i>file</i> has not been accessed.

  File.new("testfile").atime   #=> Wed Dec 31 18:00:00 CST 1969

Source Code

/*
*  call-seq:
*     file.atime    => time
*  
*  Returns the last access time (a <code>Time</code> object)
*   for <i>file</i>, or epoch if <i>file</i> has not been accessed.
*     
*     File.new("testfile").atime   #=> Wed Dec 31 18:00:00 CST 1969
*     
*/

static VALUE
rb_file_atime(obj)
   VALUE obj;
{
   OpenFile *fptr;
   struct stat st;

   GetOpenFile(obj, fptr);
   if (fstat(fileno(fptr->f), &st) == -1) {
       rb_sys_fail(fptr->path);
   }
   return rb_time_new(st.st_atime, 0);
}
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.