summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--configure.in18
-rw-r--r--process.c14
3 files changed, 35 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 53c99858f3..f8922f6dff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Jul 6 23:30:04 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (rb_proc_times): use sysconf(_SC_CLK_TCK) value prior to
+ HZ and CLK_TCK. fixed: [ruby-talk:200293]
+
Thu Jul 6 21:50:06 2006 Minero Aoki <aamine@loveruby.net>
* ext/racc/cparse/cparse.c: sync with original code, rev 1.8.
@@ -10,7 +15,7 @@ Thu Jul 6 21:50:06 2006 Minero Aoki <aamine@loveruby.net>
Wed Jul 5 01:12:19 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
- * test/ruby/test_lambda.rb (TestLambdaParameters::test_lambda_as_iterator):
+ * test/ruby/test_lambda.rb (TestLambdaParameters::test_lambda_as_iterator):
-> style block no longer available. [ruby-dev:28958]
Tue Jul 4 21:48:56 2006 NAKAMURA Usaku <usa@ruby-lang.org>
@@ -30,9 +35,9 @@ Tue Jul 4 04:48:36 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
Mon Jul 3 19:04:38 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/tcltklib.c (ip_make_menu_embeddable): help to make a menu
- widget embeddable (pack, grid, and so on) like as a general widget.
+ widget embeddable (pack, grid, and so on) like as a general widget.
However, an embeddable menu may require to be definied some event
- bindings for general use.
+ bindings for general use.
* ext/tk/lib/tk/event.rb: [bug fix] Tk.callback_break and
Tk.callback_continue don't work on MultiTkIp.
diff --git a/configure.in b/configure.in
index 1c9c660d1d..cd8f64bc4a 100644
--- a/configure.in
+++ b/configure.in
@@ -510,7 +510,7 @@ AC_CHECK_FUNCS(fmod killpg wait4 waitpid fork spawnv syscall chroot fsync getcwd
setitimer setruid seteuid setreuid setresuid setproctitle socketpair\
setrgid setegid setregid setresgid issetugid pause lchown lchmod\
getpgrp setpgrp getpgid setpgid initgroups getgroups setgroups\
- getpriority getrlimit setrlimit\
+ getpriority getrlimit setrlimit sysconf\
dlopen sigprocmask sigaction _setjmp vsnprintf snprintf\
setsid telldir seekdir fchmod mktime timegm cosh sinh tanh log2\
setuid setgid daemon select_large_fdset setenv unsetenv)
@@ -728,6 +728,22 @@ if test $rb_cv_huge_st_ino = yes; then
AC_DEFINE(HUGE_ST_INO)
fi
+if test "$ac_cv_func_sysconf" = yes; then
+ AC_DEFUN(RUBY_CHECK_SYSCONF, [dnl
+ AC_CACHE_CHECK([whether _SC_$1 is supported], rb_cv_have_sc_[]m4_tolower($1),
+ [AC_TRY_COMPILE([#include <unistd.h>
+ ],
+ [_SC_$1 >= 0],
+ rb_cv_have_sc_[]m4_tolower($1)=yes,
+ rb_cv_have_sc_[]m4_tolower($1)=no)
+ ])
+ if test "$rb_cv_have_sc_[]m4_tolower($1)" = yes; then
+ AC_DEFINE(HAVE__SC_$1)
+ fi
+ ])
+ RUBY_CHECK_SYSCONF(CLK_TCK)
+fi
+
case "$target_cpu" in
m68*|i?86|ia64|sparc*|alpha*) rb_cv_stack_grow_dir=-1;;
hppa*) rb_cv_stack_grow_dir=+1;;
diff --git a/process.c b/process.c
index 97a45d5986..5b4672b0e0 100644
--- a/process.c
+++ b/process.c
@@ -3516,6 +3516,10 @@ VALUE
rb_proc_times(VALUE obj)
{
#if defined(HAVE_TIMES) && !defined(__CHECKER__)
+ const double hz =
+#ifdef HAVE__SC_CLK_TCK
+ (double)sysconf(_SC_CLK_TCK);
+#else
#ifndef HZ
# ifdef CLK_TCK
# define HZ CLK_TCK
@@ -3523,15 +3527,17 @@ rb_proc_times(VALUE obj)
# define HZ 60
# endif
#endif /* HZ */
+ HZ;
+#endif
struct tms buf;
volatile VALUE utime, stime, cutime, sctime;
times(&buf);
return rb_struct_new(S_Tms,
- utime = rb_float_new((double)buf.tms_utime / HZ),
- stime = rb_float_new((double)buf.tms_stime / HZ),
- cutime = rb_float_new((double)buf.tms_cutime / HZ),
- sctime = rb_float_new((double)buf.tms_cstime / HZ));
+ utime = rb_float_new(buf.tms_utime / hz),
+ stime = rb_float_new(buf.tms_stime / hz),
+ cutime = rb_float_new(buf.tms_cutime / hz),
+ sctime = rb_float_new(buf.tms_cstime / hz));
#else
rb_notimplement();
#endif