[#54777] [ruby-trunk - Feature #8368][Open] Socket.getifaddrs — "akr (Akira Tanaka)" <akr@...>
6 messages
2013/05/04
[#54784] Call setlocale(LC_ALL, "") instead of setlocale(LC_CTYPE, "") — Nikolai Weibull <now@...>
Hi!
6 messages
2013/05/04
[#54786] Re: Call setlocale(LC_ALL, "") instead of setlocale(LC_CTYPE, "")
— Tanaka Akira <akr@...>
2013/05/04
2013/5/5 Nikolai Weibull <now@disu.se>:
[#54800] Re: Call setlocale(LC_ALL, "") instead of setlocale(LC_CTYPE, "")
— Nikolai Weibull <now@...>
2013/05/05
On Sun, May 5, 2013 at 12:56 AM, Tanaka Akira <akr@fsij.org> wrote:
[#54810] Re: Call setlocale(LC_ALL, "") instead of setlocale(LC_CTYPE, "")
— KOSAKI Motohiro <kosaki.motohiro@...>
2013/05/05
>> I think it is acceptable that make ruby more robust.
[#54850] [ruby-trunk - Feature #8377][Open] Deprecate :: for method calls in 2.1 — "charliesome (Charlie Somerville)" <charliesome@...>
27 messages
2013/05/07
[#54915] [ruby-trunk - Feature #8377] Deprecate :: for method calls in 2.1
— "jeremyevans0 (Jeremy Evans)" <merch-redmine@...>
2013/05/11
[#54900] [ruby-trunk - Bug #8386][Open] OpenSSL thread safety — "dbussink (Dirkjan Bussink)" <d.bussink@...>
12 messages
2013/05/10
[#54924] Re: [ruby-changes:28599] hsbt:r40651 (trunk): fixed wrong document for Socket.tcp by @lann [fix GH-302] — Tanaka Akira <akr@...>
2013/5/12 hsbt <ko1@atdot.net>:
4 messages
2013/05/12
[#54939] [ruby-trunk - Bug #8399][Open] Remove usage of RARRAY_PTR in C extensions when not needed — "dbussink (Dirkjan Bussink)" <d.bussink@...>
32 messages
2013/05/12
[#54963] [ruby-trunk - Bug #8399] Remove usage of RARRAY_PTR in C extensions when not needed
— "dbussink (Dirkjan Bussink)" <d.bussink@...>
2013/05/13
[#55001] [ruby-trunk - Bug #8399] Remove usage of RARRAY_PTR in C extensions when not needed
— "dbussink (Dirkjan Bussink)" <d.bussink@...>
2013/05/15
[#55004] Re: [ruby-trunk - Bug #8399] Remove usage of RARRAY_PTR in C extensions when not needed
— SASADA Koichi <ko1@...>
2013/05/15
(2013/05/15 14:38), dbussink (Dirkjan Bussink) wrote:
[#55053] [ruby-trunk - Feature #8426][Open] Implement class hierarchy method caching — "charliesome (Charlie Somerville)" <charliesome@...>
21 messages
2013/05/19
[#55077] Re: [ruby-trunk - Feature #8426][Open] Implement class hierarchy method caching
— SASADA Koichi <ko1@...>
2013/05/20
Great work!
[#55083] Re: [ruby-trunk - Feature #8426][Open] Implement class hierarchy method caching
— Charlie Somerville <charlie@...>
2013/05/20
On Monday, 20 May 2013 at 1:35 PM, SASADA Koichi wrote:
[#55085] Re: [ruby-trunk - Feature #8426][Open] Implement class hierarchy method caching
— SASADA Koichi <ko1@...>
2013/05/20
(2013/05/20 18:21), Charlie Somerville wrote:
[#55058] [ruby-trunk - Feature #5458] DL should be removed — "luislavena (Luis Lavena)" <luislavena@...>
3 messages
2013/05/19
[#55068] Re: [ruby-cvs:48003] zzak:r40834 (trunk): * lib/pp.rb: Document PP::ObjectMixin [Fixes GH-312] — Tanaka Akira <akr@...>
2013/5/20 <zzak@ruby-lang.org>:
7 messages
2013/05/20
[#55071] Re: [ruby-cvs:48003] zzak:r40834 (trunk): * lib/pp.rb: Document PP::ObjectMixin [Fixes GH-312]
— Zachary Scott <zachary@...>
2013/05/20
@akr Oh, thank you for pointing that out!
[#55072] Re: [ruby-cvs:48003] zzak:r40834 (trunk): * lib/pp.rb: Document PP::ObjectMixin [Fixes GH-312]
— Tanaka Akira <akr@...>
2013/05/20
2013/5/20 Zachary Scott <zachary@zacharyscott.net>:
[#55073] Re: [ruby-cvs:48003] zzak:r40834 (trunk): * lib/pp.rb: Document PP::ObjectMixin [Fixes GH-312]
— Zachary Scott <zachary@...>
2013/05/20
On Sun, May 19, 2013 at 10:11 PM, Tanaka Akira <akr@fsij.org> wrote:
[#55075] Re: [ruby-cvs:48003] zzak:r40834 (trunk): * lib/pp.rb: Document PP::ObjectMixin [Fixes GH-312]
— Tanaka Akira <akr@...>
2013/05/20
2013/5/20 Zachary Scott <zachary@zacharyscott.net>:
[#55096] [ruby-trunk - Feature #8430][Open] Rational number literal — "mrkn (Kenta Murata)" <muraken@...>
28 messages
2013/05/21
[#55197] [ruby-trunk - Feature #8461][Open] Easy way to disable certificate checking in XMLRPC::Client — "herwinw (Herwin Weststrate)" <herwin@...>
11 messages
2013/05/29
[#55198] [ruby-trunk - Feature #8462][Open] Module.remove_const inconsistant naming — "kyledecot (Kyle Decot)" <kyle.decot@...>
7 messages
2013/05/29
[ruby-core:55065] [ruby-trunk - Bug #8428][Open] Date#to_time yields incorrect value for Julian dates
From:
"teleological (Riley Lynch)" <oss+ruby-lang@...>
Date:
2013-05-19 23:03:39 UTC
List:
ruby-core #55065
Issue #8428 has been reported by teleological (Riley Lynch).
----------------------------------------
Bug #8428: Date#to_time yields incorrect value for Julian dates
https://bugs.ruby-lang.org/issues/8428
Author: teleological (Riley Lynch)
Status: Open
Priority: Normal
Assignee:
Category: ext
Target version:
ruby -v: ruby 1.9.3p429 (2013-05-15 revision 40747) [x86_64-darwin12.3.0]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN
=begin
Date instances with Julian day values that precede the calendar reform start day (i.e. #julian? == true), return Time objects which do not correspond to the chronological Julian day which the Date instances represent.
d = Date.new(1582, 10, 15)
d.gregorian? # => true
d = d.jd # => 2299161
d.to_time.to_date.jd # => 2299161 (OK)
d = Date.new(1582, 10, 4)
d.gregorian? # => false
d = d.jd # => 2299160
d.to_time.to_date.jd # => 2299150 (!)
An equivalent Date object using a fixed Gregorian calendar does not exhibit the same behavior:
d = Date.new(1582, 10, 14, Date::GREGORIAN)
d == Date.new(1582, 10, 4) # => true
d = d.jd # => 2299160
d.to_time.to_date.jd # => 2299160 (OK)
Since the documentation for Date#to_time is not detailed about the expected behavior of Date#to_time ("returns a Time object which denotes self"), and since no rubyspec has been defined for this method yet, I realize that it is contentious to describe this behavior as a bug, so I'd like to put a few arguments forward that the current behavior is not correct or desirable.
(1) Since 1.9, Time#to_date always uses the Gregorian year, month and day indicated by a Time instance to construct a Date instance. This is a correction from Ruby 1.8's private Time#to_date, which used the calendar representation of the date according to the default reform day.
(2) The value of a Time instance is an instant defined as an offset from the Unix epoch. The instant falls within a particular chronological Julian day beginning at UTC-offset midnight. Date#to_time should respect the relationship between the chronological Julian day value of the Date instance and the Unix epoch offset value of the Time instance: If the value of the Time instance doesn't fall within the same chronological Julian day as is represented by the Date instance, the conversion is incorrect.
(3) Although an instance of Time is capable of representing the beginning of any chronological Julian day, it is not capable or representing a date in the Julian calendar. Since an instance of Time masquerading as a Julian date such as the current result of (({Date.new(1582, 10, 4).to_time})) actually represents a different value, its value and any calculations based on its value are likely to mislead, as are comparisons with other instances of Time.
The following patch to (({ext/date/date_core.c})) would make Date#to_time work uniformly for Gregorian and Julian dates:
@@ -8604,12 +8604,21 @@ time_to_datetime(VALUE self)
static VALUE
date_to_time(VALUE self)
{
- get_d1(self);
-
- return f_local3(rb_cTime,
- m_real_year(dat),
- INT2FIX(m_mon(dat)),
- INT2FIX(m_mday(dat)));
+ get_d1a(self);
+ if (m_julian_p(adat)) {
+ VALUE tmp = d_lite_gregorian(self);
+ get_d1b(tmp);
+ return f_local3(rb_cTime,
+ m_real_year(bdat),
+ INT2FIX(m_mon(bdat)),
+ INT2FIX(m_mday(bdat)));
+ }
+ else {
+ return f_local3(rb_cTime,
+ m_real_year(adat),
+ INT2FIX(m_mon(adat)),
+ INT2FIX(m_mday(adat)));
+ }
}
If this proposal is too contentious for a bug report, I would be glad to reintroduce it in a mailing list or in whatever forum is deemed more appropriate for discussing a change like this. Thank you for your consideration!
=end
--
http://bugs.ruby-lang.org/