diff options
-rw-r--r-- | common.mk | 2 | ||||
-rw-r--r-- | thread.c | 1 | ||||
-rw-r--r-- | thread_pthread.c | 10 | ||||
-rw-r--r-- | thread_win32.c | 10 | ||||
-rw-r--r-- | time.c | 21 | ||||
-rw-r--r-- | timev.h | 21 |
6 files changed, 23 insertions, 42 deletions
@@ -745,7 +745,7 @@ struct.$(OBJEXT): {$(VPATH)}struct.c $(RUBY_H_INCLUDES) {$(VPATH)}internal.h thread.$(OBJEXT): {$(VPATH)}thread.c {$(VPATH)}eval_intern.h \ $(RUBY_H_INCLUDES) {$(VPATH)}gc.h $(VM_CORE_H_INCLUDES) \ {$(VPATH)}thread_$(THREAD_MODEL).c $(ENCODING_H_INCLUDES) \ - {$(VPATH)}internal.h {$(VPATH)}io.h {$(VPATH)}thread.h + {$(VPATH)}internal.h {$(VPATH)}io.h {$(VPATH)}thread.h {$(VPATH)}timev.h transcode.$(OBJEXT): {$(VPATH)}transcode.c $(RUBY_H_INCLUDES) \ $(ENCODING_H_INCLUDES) {$(VPATH)}transcode_data.h {$(VPATH)}internal.h cont.$(OBJEXT): {$(VPATH)}cont.c $(RUBY_H_INCLUDES) \ @@ -60,6 +60,7 @@ #include "eval_intern.h" #include "gc.h" #include "internal.h" +#include "timev.h" #include "ruby/io.h" #include "ruby/thread.h" diff --git a/thread_pthread.c b/thread_pthread.c index 59fd90251e..f2e18d24e4 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -363,16 +363,6 @@ native_cond_timedwait(rb_thread_cond_t *cond, pthread_mutex_t *mutex, struct tim return r; } -#if SIZEOF_TIME_T == SIZEOF_LONG -typedef unsigned long unsigned_time_t; -#elif SIZEOF_TIME_T == SIZEOF_INT -typedef unsigned int unsigned_time_t; -#elif SIZEOF_TIME_T == SIZEOF_LONG_LONG -typedef unsigned LONG_LONG unsigned_time_t; -#else -# error cannot find integer type which size is same as time_t. -#endif - static struct timespec native_cond_timeout(rb_thread_cond_t *cond, struct timespec timeout_rel) { diff --git a/thread_win32.c b/thread_win32.c index 29700c84f4..0128f6323c 100644 --- a/thread_win32.c +++ b/thread_win32.c @@ -506,16 +506,6 @@ native_cond_timedwait(rb_thread_cond_t *cond, rb_thread_lock_t *mutex, struct ti return native_cond_timedwait_ms(cond, mutex, timeout_ms); } -#if SIZEOF_TIME_T == SIZEOF_LONG -typedef unsigned long unsigned_time_t; -#elif SIZEOF_TIME_T == SIZEOF_INT -typedef unsigned int unsigned_time_t; -#elif SIZEOF_TIME_T == SIZEOF_LONG_LONG -typedef unsigned LONG_LONG unsigned_time_t; -#else -# error cannot find integer type which size is same as time_t. -#endif - static struct timespec native_cond_timeout(rb_thread_cond_t *cond, struct timespec timeout_rel) { @@ -717,27 +717,6 @@ num_exact(VALUE v) /* time_t */ -#ifndef TYPEOF_TIMEVAL_TV_SEC -# define TYPEOF_TIMEVAL_TV_SEC time_t -#endif -#ifndef TYPEOF_TIMEVAL_TV_USEC -# if INT_MAX >= 1000000 -# define TYPEOF_TIMEVAL_TV_USEC int -# else -# define TYPEOF_TIMEVAL_TV_USEC long -# endif -#endif - -#if SIZEOF_TIME_T == SIZEOF_LONG -typedef unsigned long unsigned_time_t; -#elif SIZEOF_TIME_T == SIZEOF_INT -typedef unsigned int unsigned_time_t; -#elif SIZEOF_TIME_T == SIZEOF_LONG_LONG -typedef unsigned LONG_LONG unsigned_time_t; -#else -# error cannot find integer type which size is same as time_t. -#endif - static wideval_t rb_time_magnify(wideval_t w) { @@ -18,4 +18,25 @@ struct vtm { #define TIME_SCALE 1000000000 +#ifndef TYPEOF_TIMEVAL_TV_SEC +# define TYPEOF_TIMEVAL_TV_SEC time_t +#endif +#ifndef TYPEOF_TIMEVAL_TV_USEC +# if INT_MAX >= 1000000 +# define TYPEOF_TIMEVAL_TV_USEC int +# else +# define TYPEOF_TIMEVAL_TV_USEC long +# endif +#endif + +#if SIZEOF_TIME_T == SIZEOF_LONG +typedef unsigned long unsigned_time_t; +#elif SIZEOF_TIME_T == SIZEOF_INT +typedef unsigned int unsigned_time_t; +#elif SIZEOF_TIME_T == SIZEOF_LONG_LONG +typedef unsigned LONG_LONG unsigned_time_t; +#else +# error cannot find integer type which size is same as time_t. +#endif + #endif |