зеркало из https://github.com/github/ruby.git
timev.h: move time_t stuffs
* timev.h (TYPEOF_TIMEVAL_TV_SEC, unsigned_time_t): move from time.c. * thread.c: use definitions in timev.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
f2e1bfb897
Коммит
77ff241fa0
|
@ -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) \
|
||||
|
|
1
thread.c
1
thread.c
|
@ -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"
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
21
time.c
21
time.c
|
@ -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)
|
||||
{
|
||||
|
|
21
timev.h
21
timev.h
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче