public Method

File.mtime

file.mtime  time

Returns the modification time for file.

File.new("testfile").mtime   #=> Wed Apr 09 08:53:14 CDT 2003

Source Code

/*
*  call-seq:
*     file.mtime -> time
*  
*  Returns the modification time for <i>file</i>.
*     
*     File.new("testfile").mtime   #=> Wed Apr 09 08:53:14 CDT 2003
*     
*/

static VALUE
rb_file_mtime(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_mtime, 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.