Issue #13644 has been reported by MSP-Greg (Greg L).
----------------------------------------
Bug #13644: Windows - Setting Time.now
https://bugs.ruby-lang.org/issues/13644
* Author: MSP-Greg (Greg L)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v:
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
While reviewing a MinGW build `test-all` failure in [TestLogDevice#test_shifting_midnight_exist_file](https://github.com/ruby/ruby/blob/trunk/test/logger/test_logdevice.rb#L687-L727), 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](https://stackoverflow.com/questions/650849/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:
```ruby
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?
--
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>