Method: File.mtime

Defined in:
file.c

.mtime(file_name) ⇒ Time

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

file_name can be an IO object.

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

Returns:



2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
# File 'file.c', line 2345

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

    if (rb_stat(fname, &st) < 0) {
	int e = errno;
	FilePathValue(fname);
	rb_syserr_fail_path(e, fname);
    }
    return stat_mtime(&st);
}