static public Method

File.mtime(p1)

File.mtime(file_name)    time

Returns the modification time for the named file as a Time object.

File.mtime("testfile")   #=> Tue Apr 08 12:58:04 CDT 2003

Source Code

/*
*  call-seq:
*     File.mtime(file_name)  =>  time
*  
*  Returns the modification time for the named file as a Time object.
*     
*     File.mtime("testfile")   #=> Tue Apr 08 12:58:04 CDT 2003
*     
*/

static VALUE
rb_file_s_mtime(klass, fname)
   VALUE klass, fname;
{
   struct stat st;

   if (rb_stat(fname, &st) < 0)
       rb_sys_fail(RSTRING(fname)->ptr);
   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.