summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-10-18 14:03:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-10-18 14:03:43 +0000
commit450fc7bb5706d63834807790f9f779393f5ad0c1 (patch)
tree0ea51d192c41eaeba7f6023b7b625cdfd21942ff /win32
parente18aabc7dbea54420435d3d6639f23805ce6ce76 (diff)
* win32/win32.c (rb_w32_utime): allow NULL to set the current time.
[ruby-talk:219248] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/win32/win32.c b/win32/win32.c
index de0da968f3..7c7f310bb0 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -4117,11 +4117,17 @@ rb_w32_utime(const char *path, const struct utimbuf *times)
return -1;
}
- if (unixtime_to_filetime(times->actime, &atime)) {
- return -1;
+ if (times) {
+ if (unixtime_to_filetime(times->actime, &atime)) {
+ return -1;
+ }
+ if (unixtime_to_filetime(times->modtime, &mtime)) {
+ return -1;
+ }
}
- if (unixtime_to_filetime(times->modtime, &mtime)) {
- return -1;
+ else {
+ GetSystemTimeAsFileTime(&atime);
+ mtime = atime;
}
RUBY_CRITICAL({