diff options
-rw-r--r-- | test/ruby/test_time_tz.rb | 10 | ||||
-rw-r--r-- | time.c | 1 | ||||
-rw-r--r-- | version.h | 2 |
3 files changed, 12 insertions, 1 deletions
diff --git a/test/ruby/test_time_tz.rb b/test/ruby/test_time_tz.rb index f91cd66376..9bba30e577 100644 --- a/test/ruby/test_time_tz.rb +++ b/test/ruby/test_time_tz.rb @@ -659,6 +659,16 @@ else @tz ||= TZInfo::Timezone.get(tzname) end end + + def test_fractional_second + x = Object.new + def x.local_to_utc(t); t + 8*3600; end + def x.utc_to_local(t); t - 8*3600; end + + t1 = Time.new(2020,11,11,12,13,14.124r, '-08:00') + t2 = Time.new(2020,11,11,12,13,14.124r, x) + assert_equal(t1, t2) + end end begin @@ -5152,6 +5152,7 @@ tm_from_time(VALUE klass, VALUE time) ttm = DATA_PTR(tm); v = &vtm; GMTIMEW(ttm->timew = tobj->timew, v); + ttm->timew = wsub(ttm->timew, v->subsecx); v->subsecx = INT2FIX(0); v->zone = Qnil; ttm->vtm = *v; @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.6.7" #define RUBY_RELEASE_DATE "2021-04-05" -#define RUBY_PATCHLEVEL 193 +#define RUBY_PATCHLEVEL 194 #define RUBY_RELEASE_YEAR 2021 #define RUBY_RELEASE_MONTH 4 |