Project

General

Profile

Actions

Bug #13644

closed

Windows - Setting Time.now

Added by MSP-Greg (Greg L) almost 7 years ago. Updated 7 months ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.5.0dev (2017-06-04 trunk 59013) [x64-mingw32]
[ruby-core:81625]
Tags:

Description

While reviewing a MinGW build test-all failure in TestLogDevice#test_shifting_midnight_exist_file, I determined the cause. The test in question (and other tests that seem to have newer/better exception handling) sets Time.now.

The thread StackOverflow - Change system date programmatically seems to imply that in some instances/configurations, changing the system time on Windows systems requires elevated permissions.

I tested on both a mswin build (ruby 2.5.0dev (2017-05-27 trunk 58922) [x64-mswin64_140]) and a MinGW build (ruby 2.5.0dev (2017-06-08 trunk 59046) [x64-mingw32]), and both responded to:

Time.now = Time.mktime(2017, 1, 3, 1, 1, 1)

with the following eror:

undefined method `now=' for Time:Class (NoMethodError)

Both also had false = Time.respond_to?(:now=).

So, I'm confused as to how this test passes on mswin. Regardless, the test requires a skip to bypass it and allow MinGW test-all to pass.

I thought I'd file an issue before doing a PR. I'm building and testing on Win7. Finally, if anyone has time, where is the method now= defined?


Files

test-logger-test_logdevice.rb.patch (3.6 KB) test-logger-test_logdevice.rb.patch test/logger/test_logdevice.rb patch file MSP-Greg (Greg L), 06/11/2017 03:43 AM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0