ruby-changes:42110
From: odaira <ko1@a...>
Date: Sat, 19 Mar 2016 03:05:54 +0900 (JST)
Subject: [ruby-changes:42110] odaira:r54184 (trunk): * test/-ext-/time/test_new.rb (test_timespec_new): change a gmtoff
odaira 2016-03-19 03:05:47 +0900 (Sat, 19 Mar 2016) New Revision: 54184 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54184 Log: * test/-ext-/time/test_new.rb (test_timespec_new): change a gmtoff test to a better one that does not depend on whether the current time is in summer time or not. Modified files: trunk/ChangeLog trunk/test/-ext-/time/test_new.rb Index: test/-ext-/time/test_new.rb =================================================================== --- test/-ext-/time/test_new.rb (revision 54183) +++ test/-ext-/time/test_new.rb (revision 54184) @@ -23,9 +23,11 @@ class Bug::Time::Test_New < Test::Unit: https://github.com/ruby/ruby/blob/trunk/test/-ext-/time/test_new.rb#L23 assert_equal(false, Bug::Time.timespec_new(1447087832, 476451125, 0).utc?) assert_equal(true, Bug::Time.timespec_new(1447087832, 476451125, 0x7ffffffe).utc?) assert_equal(false, Bug::Time.timespec_new(1447087832, 476451125, 0x7fffffff).utc?) - if Time.now.isdst == Bug::Time.timespec_new(1447087832, 476451125, 0x7fffffff).isdst - assert_equal(Time.now.gmtoff, Bug::Time.timespec_new(1447087832, 476451125, 0x7fffffff).gmtoff) - end + # Cannot compare Time.now.gmtoff with + # Bug::Time.timespec_new(1447087832, 476451125, 0x7fffffff).gmtoff, because + # it depends on whether the current time is in summer time (daylight-saving time) or not. + t = Time.now + assert_equal(t.gmtoff, Bug::Time.timespec_new(t.tv_sec, t.tv_nsec, 0x7fffffff).gmtoff) assert_time_equal(Time.at(1447087832, 476451.125).localtime(86399), Bug::Time.timespec_new(1447087832, 476451125, 86399)) assert_time_equal(Time.at(1447087832, 476451.125).localtime(-86399), Index: ChangeLog =================================================================== --- ChangeLog (revision 54183) +++ ChangeLog (revision 54184) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Mar 19 03:00:50 2016 Rei Odaira <Rei.Odaira@g...> + + * test/-ext-/time/test_new.rb (test_timespec_new): change a gmtoff + test to a better one that does not depend on whether the current + time is in summer time or not. + Fri Mar 19 00:00:00 2016 Kenta Murata <mrkn@m...> * bignum.c (rb_big_to_f, Bignum#to_f): removed them because they are -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/