[#75687] [Ruby trunk Bug#12416] struct rb_id_table lacks mark function — shyouhei@...
Issue #12416 has been reported by Shyouhei Urabe.
3 messages
2016/05/23
[#75763] [Ruby trunk Feature#12435] Using connect_nonblock to open TCP connections in Net::HTTP#connect — mohamed.m.m.hafez@...
Issue #12435 has been reported by Mohamed Hafez.
3 messages
2016/05/28
[#75774] Errno::EAGAIN thrown by OpenSSL::SSL::SSLSocket#connect_nonblock — Mohamed Hafez <mohamed.m.m.hafez@...>
Hi all, every now and then in my production server, I'm
4 messages
2016/05/30
[#75775] Re: Errno::EAGAIN thrown by OpenSSL::SSL::SSLSocket#connect_nonblock
— Mohamed Hafez <mohamed.m.m.hafez@...>
2016/05/30
Or does MRI's OpenSSL::SSL::SSLSocket#connect_nonblock just return
[#75782] Important: Somewhat backwards-incompatible change (Fwd: [ruby-cvs:62388] duerst:r55225 (trunk): * string.c: Activate full Unicode case mapping for UTF-8) — Martin J. Dürst <duerst@...>
With the change below, I have activated full Unicode case mapping for
4 messages
2016/05/31
[ruby-core:75653] [Ruby trunk Misc#10473] Date.to_datetime.to_time != Date.to_time
From:
spiketeika@...
Date:
2016-05-21 04:45:46 UTC
List:
ruby-core #75653
Issue #10473 has been updated by Kaneko Yuichiro.
`Date#to_time` interprets date as the local time zone.
But `Date#to_datetime` interprets date as UTC.
I think this incompatibility is a king of bug.
We have two ways to solve this incompatibility, to make both methods to interpret date as the local time zone,
or to interpret date UTC.
It is difficult to judge which is more natural or useful.
But I always interpret date as the local time zone in my daily life...
```diff
diff --git a/ext/date/date_core.c b/ext/date/date_core.c
index 3a10fcb..4cc3dc9 100644
--- a/ext/date/date_core.c
+++ b/ext/date/date_core.c
@@ -8520,35 +8520,7 @@ date_to_date(VALUE self)
static VALUE
date_to_datetime(VALUE self)
{
- get_d1a(self);
-
- if (simple_dat_p(adat)) {
- VALUE new = d_lite_s_alloc_simple(cDateTime);
- {
- get_d1b(new);
- bdat->s = adat->s;
- return new;
- }
- }
- else {
- VALUE new = d_lite_s_alloc_complex(cDateTime);
- {
- get_d1b(new);
- bdat->c = adat->c;
- bdat->c.df = 0;
- RB_OBJ_WRITE(new, &bdat->c.sf, INT2FIX(0));
-#ifndef USE_PACK
- bdat->c.hour = 0;
- bdat->c.min = 0;
- bdat->c.sec = 0;
-#else
- bdat->c.pc = PACK5(EX_MON(adat->c.pc), EX_MDAY(adat->c.pc),
- 0, 0, 0);
- bdat->c.flags |= HAVE_DF | HAVE_TIME;
-#endif
- return new;
- }
- }
+ return time_to_datetime(date_to_time(self));
}
/*
diff --git a/test/date/test_date_conv.rb b/test/date/test_date_conv.rb
index 3729476..0feaf2a 100644
--- a/test/date/test_date_conv.rb
+++ b/test/date/test_date_conv.rb
@@ -126,10 +126,13 @@ def test_to_datetime__from_time
def test_to_datetime__from_date
d = Date.new(2004, 9, 19) + 1.to_r/2
- d2 = d.to_datetime
- assert_equal([2004, 9, 19, 0, 0, 0, 0, 0],
- [d2.year, d2.mon, d2.mday, d2.hour, d2.min, d2.sec,
- d2.sec_fraction, d2.offset])
+
+ with_tz('Asia/Tokyo') do
+ d2 = d.to_datetime
+ assert_equal([2004, 9, 19, 0, 0, 0, 0, (3.to_r/8)],
+ [d2.year, d2.mon, d2.mday, d2.hour, d2.min, d2.sec,
+ d2.sec_fraction, d2.offset])
+ end
end
def test_to_datetime__from_datetime
```
----------------------------------------
Misc #10473: Date.to_datetime.to_time != Date.to_time
https://bugs.ruby-lang.org/issues/10473#change-58786
* Author: Jack Lowe
* Status: Open
* Priority: Normal
* Assignee:
----------------------------------------
Date.new(2014,1,1).to_datetime.to_time.utc.to_s
=> "2014-01-01 00:00:00 UTC"
Date.new(2014,1,1).to_time.utc.to_s
=> "2014-01-01 05:00:00 UTC"
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>