-
-
Notifications
You must be signed in to change notification settings - Fork 925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File.mtime doesn't return milliseconds #4520
Comments
@harshvardhansharma We cannot bypass some limitations of file systems. But this should work on file systems that allow, especially where MRI works. |
@AlexWayfer, right and seems to be working on a machine with MRI interpreter, will try with jRuby one and see how it can be fixed. |
@harshvardhansharma I found this: #4393 and #1951 But they are not about files. I think it's a flaw in JRuby, but can't say for sure, because not worked with him closely. |
@harshvardhansharma Thanks for the investigation on this one! It appears that in order to support this we would need to conditionally access the newer st_mtim etc timespec fields on the stat struct. This needs to be done in https://github.com/jnr/jnr-posix before we can use it in JRuby. |
Good news! It looks like we may have the nsec fields mapped already in jnr-posix. I'll see if I can wire them up. |
And more good news...as of Java 7, the "NIO 2" file APIs also appear to support nsec resolution. It may be possible to expose them without tying jnr-posix to Java 7, but I'm just going to wire it up for native UNIX stats for now. |
Someone want to contribute a spec to https://github.com/ruby/spec for this behavior? I don't see any existing stat a/c/mtime nanosecond specs in there and we don't want this to get missed. |
Reference: jruby/jruby#4520 (comment) Three attemps to avoid zero in these values with small sleep (if failed). And some code refactoring.
Reference: jruby/jruby#4520 (comment) Three attemps to avoid zero in these values with small sleep (if failed). And some code refactoring.
@headius I'm trying! |
Reference: jruby/jruby#4520 (comment) Three attemps to avoid zero in these values with small sleep (if failed). And some code refactoring.
Reference: jruby/jruby#4520 (comment) Three attemps to avoid zero in these values with small sleep (if failed). And some code refactoring.
Reference: jruby/jruby#4520 (comment) Three attemps to avoid zero in these values with small sleep (if failed). And some code refactoring.
And done! |
Thank you! |
Environment
9.1.7.0
(and older)4.9.11
rbenv
Expected Behavior
File.mtime
returnsTime
with milliseconds:Actual Behavior
File.mtime
returnsTime
without milliseconds:The text was updated successfully, but these errors were encountered: