diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-07-06 13:22:23 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-07-06 13:22:23 +0000 |
| commit | dd20ee1e5588af84162c9eeeab93a555f1f5d50e (patch) | |
| tree | c31cec4972377b6edd5927847f8340b36d871a2b /process.c | |
| parent | 5f2229dc0f8e5f0d4b85f02a9585dda0f9ff4445 (diff) | |
| download | ruby-dd20ee1e5588af84162c9eeeab93a555f1f5d50e.tar.gz ruby-dd20ee1e5588af84162c9eeeab93a555f1f5d50e.tar.xz ruby-dd20ee1e5588af84162c9eeeab93a555f1f5d50e.zip | |
* process.c (rb_proc_times): use sysconf(_SC_CLK_TCK) value prior to
HZ and CLK_TCK. fixed: [ruby-talk:200293]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@10475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
| -rw-r--r-- | process.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -3432,6 +3432,10 @@ rb_proc_times(obj) 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 @@ -3439,15 +3443,17 @@ rb_proc_times(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 |
