FIX properly extract millis from the nsec part of timespec#58
Open
zuzkins wants to merge 1 commit intomafintosh:masterfrom
Open
FIX properly extract millis from the nsec part of timespec#58zuzkins wants to merge 1 commit intomafintosh:masterfrom
zuzkins wants to merge 1 commit intomafintosh:masterfrom
Conversation
nsec holds nanoseconds, so we need to divide it by 10^6 to get milliseconds back.
Contributor
|
this explains the behavior I was witnessing a few months ago -- good catch! |
Contributor
|
@mafintosh this looks ready to merge |
frank-dspeed
added a commit
to direktspeed/node-fuse-bindings
that referenced
this pull request
Nov 24, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There is currently a problem with the function
bindings_get_date, in that it does not compute themspart of the timestamp correctly.The
nspart oftimespecshould be divided by1 000 000rather than1 000as it is the case right now.This problem manifests itself when implementing
utimensfunction:I have
debugon when mounting my FS through OSX FUSE and when I touch a file this is the logged output:But when I log the arguments my implementation is given:
Those are few minutes off (they are shifted in to the future). Correct timestamp is
new Date(1502873454.867636000 * 1000) => Wed Aug 16 2017 10:50:54 GMT+0200 (CEST). Right now the millisecond part is added together with seconds and nanoseconds are used instead of millis.This pull request fixes mentioned problem. I have no idea how to test this other than manually:
OSX FUSE log:
After fixing it locally, my app logs:
Which is what is expected:
new Date(1502873614.070006000 * 1000) => Wed Aug 16 2017 10:53:34 GMT+0200 (CEST)I have also looked at the function
bindings_set_date, but it seems to me, that it is implemented correctly.Thank you for your effort you put into fuse-bindings!