You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
To match CRuby, File#mtime (and related methods) should honor the TZ environment variable, just like Time.now. This works correctly on Linux. The behavior differs on Windows. Time.now honors the TZ environment variable, whereas File#mtime does not.
Here's an example script to demonstrate the issue:
If you run the script without setting the TZ environment variable, you will get your local utc offset (assuming, of course, your system time is not already set to UTC).
set TZ=
jruby test.rb
#=> -21600
#=> -21600
#=> -25200
If you run the script with TZ=UTC, you should see 0 for all three values. However, on JRuby for Windows, the first value is not 0.
set TZ=UTC
jruby test.rb
#=> -21600
#=> 0
#=> 0
Here's the result you get on JRuby for Linux, consistent with CRuby.
TZ=UTC jruby test.rb
#=> 0
#=> 0
#=> 0
The text was updated successfully, but these errors were encountered:
I am a beginner and would like to work on this. To be clear, are you looking to implement the workaround or find a solution to why it is not returning what is expected on a Windows machine?
@ladybando Sorry we never saw your comment! I encourage you to look at other issues or stop by our chat (http://jruby.org/chat) if you are still interested in helping out.
Environment Information
Expected Behavior
To match CRuby, File#mtime (and related methods) should honor the TZ environment variable, just like Time.now. This works correctly on Linux. The behavior differs on Windows. Time.now honors the TZ environment variable, whereas File#mtime does not.
Here's an example script to demonstrate the issue:
Actual Behavior
If you run the script without setting the TZ environment variable, you will get your local utc offset (assuming, of course, your system time is not already set to UTC).
If you run the script with
TZ=UTC
, you should see 0 for all three values. However, on JRuby for Windows, the first value is not 0.Here's the result you get on JRuby for Linux, consistent with CRuby.
The text was updated successfully, but these errors were encountered: