utime(...)
public
Sets the access and modification times of each named file to the first two
arguments. Returns the number of file names in the argument list.
Show source
/*
* call-seq:
* File.utime(atime, mtime, file_name,...) => integer
*
* Sets the access and modification times of each
* named file to the first two arguments. Returns
* the number of file names in the argument list.
*/
static VALUE
rb_file_s_utime(argc, argv)
int argc;
VALUE *argv;
{
VALUE atime, mtime, rest;
struct timeval tvs[2], *tvp = NULL;
long n;
rb_secure(2);
rb_scan_args(argc, argv, "2*", &atime, &mtime, &rest);
if (!NIL_P(atime) || !NIL_P(mtime)) {
tvp = tvs;
tvp[0] = rb_time_timeval(atime);
tvp[1] = rb_time_timeval(mtime);
}
n = apply2files(utime_internal, rest, tvp);
return LONG2FIX(n);
}