From: "luislavena (Luis Lavena)" Date: 2012-07-28T09:02:36+09:00 Subject: [ruby-core:46821] [ruby-trunk - Bug #6794][Assigned] x64 mingw: test_at(TestTime) failure Issue #6794 has been updated by luislavena (Luis Lavena). Category set to core Status changed from Open to Assigned Assignee changed from luislavena (Luis Lavena) to nobu (Nobuyoshi Nakada) Target version set to 2.0.0 % Done changed from 0 to 50 =begin Thank you Hiroshi, I can confirm patch works: Finished tests in 0.085005s, 764.6609 tests/s, 7411.3287 assertions/s. 65 tests, 630 assertions, 0 failures, 0 errors, 0 skips ruby -v: ruby 2.0.0dev (2012-07-27 trunk 36551) [x64-mingw32] Reassigning to Nobu for final consideration. =end ---------------------------------------- Bug #6794: x64 mingw: test_at(TestTime) failure https://bugs.ruby-lang.org/issues/6794#change-28499 Author: h.shirosaki (Hiroshi Shirosaki) Status: Assigned Priority: Normal Assignee: nobu (Nobuyoshi Nakada) Category: core Target version: 2.0.0 ruby -v: ruby 2.0.0dev (2012-07-25 trunk 36538) [x64-mingw32] x64 mingw has the following failure. [ 5/65] TestTime#test_at = 0.00 s 1) Failure: test_at(TestTime) [c:/Users/hiroshi/work/ruby/test/ruby/test_time.rb:194]: <-146138510344> expected but was <1970>. I guess Time.at(large value) fails for the following reason. Time.at calls FileTimeToSystemTime() in localtime_r(). https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L6565 Time limit is 0x8000000000000000 which is a little smaller than 8bytes(= time_t)(= long long). http://msdn.microsoft.com/en-us/library/windows/desktop/ms724280(v=vs.85).aspx Instead, using _localtime_64s() seems to work fine. I changed to use _gmtime_64s() for consistency. I added declarations since mingw-w64 doesn't have these declaration. I attached a patch. -- http://bugs.ruby-lang.org/