atime()
public
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
Show source
/*
* 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
*
*/
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);
}