summaryrefslogtreecommitdiff
path: root/win32/win32.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-06 05:23:28 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-06 05:23:28 +0000
commitf245f0c664819eaa96df7a29319d5a6a118d9fb8 (patch)
tree2dbcc0c81e023f67d72eec3d349055493ccf63c6 /win32/win32.c
parent64455007e69a992f2379cfb72076deaa7caf8210 (diff)
win32.c: clock_getres
* win32/win32.c (clock_getres): required as well as clock_gettime(). [ruby-dev:47699] [Bug #8869] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32/win32.c')
-rw-r--r--win32/win32.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/win32/win32.c b/win32/win32.c
index d5bf292cdf..b888e9c9e6 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -4346,6 +4346,35 @@ clock_gettime(clockid_t clock_id, struct timespec *sp)
}
/* License: Ruby's */
+int
+clock_getres(clockid_t clock_id, struct timespec *sp)
+{
+ switch (clock_id) {
+ case CLOCK_REALTIME:
+ {
+ sp->tv_sec = 0;
+ sp->tv_nsec = 1000;
+ return 0;
+ }
+ case CLOCK_MONOTONIC:
+ {
+ LARGE_INTEGER freq;
+ LARGE_INTEGER count;
+ if (!QueryPerformanceFrequency(&freq)) {
+ errno = map_errno(GetLastError());
+ return -1;
+ }
+ sp->tv_sec = 0;
+ sp->tv_nsec = (long)(1000000000.0 / freq.QuadPart);
+ return 0;
+ }
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+}
+
+/* License: Ruby's */
char *
rb_w32_getcwd(char *buffer, int size)
{