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
This commit is contained in:
parent
64455007e6
commit
f245f0c664
@ -1,3 +1,8 @@
|
|||||||
|
Fri Sep 6 14:23:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* win32/win32.c (clock_getres): required as well as clock_gettime().
|
||||||
|
[ruby-dev:47699] [Bug #8869]
|
||||||
|
|
||||||
Fri Sep 6 11:45:27 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Fri Sep 6 11:45:27 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* transcode.c (rb_econv_append): new function to append a string data
|
* transcode.c (rb_econv_append): new function to append a string data
|
||||||
|
@ -317,6 +317,7 @@ extern int link(const char *, const char *);
|
|||||||
extern int rb_w32_ulink(const char *, const char *);
|
extern int rb_w32_ulink(const char *, const char *);
|
||||||
extern int gettimeofday(struct timeval *, struct timezone *);
|
extern int gettimeofday(struct timeval *, struct timezone *);
|
||||||
extern int clock_gettime(clockid_t, struct timespec *);
|
extern int clock_gettime(clockid_t, struct timespec *);
|
||||||
|
extern int clock_getres(clockid_t, struct timespec *);
|
||||||
extern rb_pid_t waitpid (rb_pid_t, int *, int);
|
extern rb_pid_t waitpid (rb_pid_t, int *, int);
|
||||||
extern rb_pid_t rb_w32_spawn(int, const char *, const char*);
|
extern rb_pid_t rb_w32_spawn(int, const char *, const char*);
|
||||||
extern rb_pid_t rb_w32_aspawn(int, const char *, char *const *);
|
extern rb_pid_t rb_w32_aspawn(int, const char *, char *const *);
|
||||||
|
@ -642,6 +642,7 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub
|
|||||||
#define HAVE_MEMMOVE 1
|
#define HAVE_MEMMOVE 1
|
||||||
#define HAVE_MKDIR 1
|
#define HAVE_MKDIR 1
|
||||||
#define HAVE_CLOCK_GETTIME 1
|
#define HAVE_CLOCK_GETTIME 1
|
||||||
|
#define HAVE_CLOCK_GETRES 1
|
||||||
#define HAVE_SPAWNV 1
|
#define HAVE_SPAWNV 1
|
||||||
#define HAVE_STRCASECMP 1
|
#define HAVE_STRCASECMP 1
|
||||||
#define HAVE_STRNCASECMP 1
|
#define HAVE_STRNCASECMP 1
|
||||||
|
@ -4345,6 +4345,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 */
|
/* License: Ruby's */
|
||||||
char *
|
char *
|
||||||
rb_w32_getcwd(char *buffer, int size)
|
rb_w32_getcwd(char *buffer, int size)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user