summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-24 05:20:32 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-24 05:20:32 +0000
commit79255ac86cb86832fca4b5a326b2e5bf54d68d36 (patch)
tree85919429310565738989ddf6347ff596ecb9bc65 /file.c
parentc97a6987b62726a20570fb06681c986cf7f60141 (diff)
downloadruby-79255ac86cb86832fca4b5a326b2e5bf54d68d36.tar.gz
file.c: same timespec
* file.c (rb_file_s_utime): same timespec for same time object. assume time objects are static. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/file.c b/file.c
index d2e2336439..d5ad01006b 100644
--- a/file.c
+++ b/file.c
@@ -2686,7 +2686,10 @@ rb_file_s_utime(int argc, VALUE *argv)
if (!NIL_P(args.atime) || !NIL_P(args.mtime)) {
tsp = tss;
tsp[0] = rb_time_timespec(args.atime);
- tsp[1] = rb_time_timespec(args.mtime);
+ if (args.atime == args.mtime)
+ tsp[1] = tsp[0];
+ else
+ tsp[1] = rb_time_timespec(args.mtime);
}
args.tsp = tsp;