ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: nobu@ruby-lang.org
To: ruby-core@ruby-lang.org
Subject: [ruby-core:81647] [Ruby trunk Bug#13644] Windows - Setting Time.now
Date: Sat, 10 Jun 2017 10:35:07 +0000	[thread overview]
Message-ID: <redmine.journal-65341.20170610103507.95ee5c86a805112d@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-13644.20170609030012@ruby-lang.org

Issue #13644 has been updated by nobu (Nobuyoshi Nakada).


It's defined in `FakeTime` module which is prepended to `Time`.
I haven't seen that failure on mingw.


----------------------------------------
Bug #13644: Windows - Setting Time.now
https://bugs.ruby-lang.org/issues/13644#change-65341

* Author: MSP-Greg (Greg L)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.5.0dev (2017-06-04 trunk 59013) [x64-mingw32]
* 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/

  parent reply	other threads:[~2017-06-10 10:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-13644.20170609030012@ruby-lang.org>
2017-06-09  3:00 ` [ruby-core:81625] [Ruby trunk Bug#13644] Windows - Setting Time.now Greg.mpls
2017-06-09 22:32 ` [ruby-core:81644] " Greg.mpls
2017-06-10 10:35 ` nobu [this message]
2017-06-10 14:09 ` [ruby-core:81648] " Greg.mpls
2017-06-11  3:43 ` [ruby-core:81649] " Greg.mpls

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-65341.20170610103507.95ee5c86a805112d@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).