[#38371] Re: [ruby-cvs:30538] Ruby:r23320 (trunk): * lib/set.rb (SortedSet#add): Do not let an uncomparable object — "Yugui (Yuki Sonoda)" <yugui@...>
Yuguiです。
At Mon, 4 May 2009 23:44:22 +0900,
遠藤です。
At Fri, 8 May 2009 02:00:10 +0900,
[#38372] making install-sh more descriptive — "Yugui (Yuki Sonoda)" <yugui@...>
install-shが空になって久しい(r520)です。
[#38382] [Bug #1442] indentation check and coverage for toplevel do not work — Yusuke Endoh <redmine@...>
Bug #1442: indentation check and coverage for toplevel do not work
[#38390] [Bug:1.8] Tempfile and extended Enumerable — Tanaka Akira <akr@...>
1.8.8dev で、以下のように、Enumerable に each2 を定義し、
[#38392] Enumerable#gather_each — Tanaka Akira <akr@...>
ときに、複数行をまとめて扱いたいことがあります。
ujihisaと申します。
まつもと ゆきひろです
At Sun, 10 May 2009 06:00:08 +0900,
In article <E1M2t0u-0000Aa-Sd@x61.netlab.jp>,
まつもと ゆきひろです
In article <E1M4oSd-00005c-WB@x61.netlab.jp>,
In article <873ab3531u.fsf@fsij.org>,
まつもと ゆきひろです
At Sat, 9 May 2009 15:30:20 +0900,
In article <86r5yy2nrg.knu@iDaemons.org>,
At Sun, 10 May 2009 10:08:47 +0900,
In article <86ocu132gq.knu@iDaemons.org>,
At Sun, 10 May 2009 15:57:33 +0900,
In article <86my9l2tts.knu@iDaemons.org>,
Haskell の groupBy と Python の groupby が似ている、という話
遠藤です。
In article <e0b1e5700905140800y6d701c6fj731a59ffd83b9d79@mail.gmail.com>,
[#38423] longlife gc — Narihiro Nakamura <authornari@...>
nariと申します.
[#38446] [Bug:1.9] exact Time and inexact Time — Yusuke ENDOH <mame@...>
遠藤です。
In article <e0b1e5700905132145i32bed2f0y80faef19c119824f@mail.gmail.com>,
遠藤です。
[#38463] SQLiteライブラリ — "NARUSE, Yui" <naruse@...>
成瀬です。
[#38486] [Bug #1483] some commands installed without program-suffix — Kazuhiro NISHIYAMA <redmine@...>
Bug #1483: some commands installed without program-suffix
[#38493] [Feature:trunk] enhancement of Array#drop — "U.Nakamura" <usa@...>
こんにちは、なかむら(う)です。
まつもと ゆきひろです
こんにちは、なかむら(う)です。
[#38518] [Bug:1.9] Enumerator.new { }.take(1).inject(&:+) causes stack overflow — Yusuke ENDOH <mame@...>
遠藤です。
[#38524] [Bug #1503] -Kuをつけた時、/[#{s}]/n と Regexp.new("[#{s}]",nil,"n") で実行結果が異なる — sinnichi eguchi <redmine@...>
Bug #1503: -Kuをつけた時、/[#{s}]/n と Regexp.new("[#{s}]",nil,"n") で実行結果が異なる
[ruby-dev:38491] Re: [Bug:1.9] exact Time and inexact Time
遠藤です。
2009/05/18 9:05 Yukihiro Matsumoto <matz@ruby-lang.org>:
> まつもと ゆきひろです
>
> In message "Re: [ruby-dev:38484] Re: [Bug:1.9] exact Time and inexact Time"
> on Sun, 17 May 2009 21:46:01 +0900, Tanaka Akira <akr@fsij.org> writes:
>
> |Time#to_r を加えるのはあり得ると思います。
>
> 私もこちらに賛成します。
それではパッチを書きました。
- Time#to_r を追加
- Time#- は常に Float を返す (1.9.1 と同じ挙動)
特に反対がなければコミットしようと思います。
Index: time.c
===================================================================
--- time.c (revision 23485)
+++ time.c (working copy)
@@ -2277,6 +2277,30 @@
/*
* call-seq:
+ * time.to_r => Rational
+ *
+ * Returns the value of <i>time</i> as a rational number of seconds
+ * since the Epoch.
+ *
+ * t = Time.now
+ * p t.to_r #=> (8807170717088293/8388608)
+ *
+ * This method is intended to be used to get an accurate value
+ * representing nanoseconds from the Epoch. You can use this
+ * to convert time to another Epoch.
+ */
+
+static VALUE
+time_to_r(VALUE time)
+{
+ struct time_object *tobj;
+
+ GetTimeval(time, tobj);
+ return tobj->timev;
+}
+
+/*
+ * call-seq:
* time.usec => int
* time.tv_usec => int
*
@@ -2803,7 +2827,7 @@
struct time_object *tobj2;
GetTimeval(time2, tobj2);
- return sub(tobj->timev, tobj2->timev);
+ return rb_Float(sub(tobj->timev, tobj2->timev));
}
return time_add(tobj, time2, -1);
}
@@ -3682,6 +3706,7 @@
rb_define_method(rb_cTime, "to_i", time_to_i, 0);
rb_define_method(rb_cTime, "to_f", time_to_f, 0);
+ rb_define_method(rb_cTime, "to_r", time_to_r, 0);
rb_define_method(rb_cTime, "<=>", time_cmp, 1);
rb_define_method(rb_cTime, "eql?", time_eql, 1);
rb_define_method(rb_cTime, "hash", time_hash, 0);
--
Yusuke ENDOH <mame@tsg.ne.jp>