-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
fs: add *timeNs properties to BigInt Stats objects #21387
Conversation
cc @nodejs/fs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it. One nit.
nsFromTimeSpecBigInt(stats[14 + offset], stats[15 + offset]), | ||
nsFromTimeSpecBigInt(stats[16 + offset], stats[17 + offset]) | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else
would a touch clearer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Fishrock123 I think we prefer leaving out the else block for early returns? There used to a PR adding a lint rule for that although it didn't land due to the amount of churn.
While I'm good with this, changing |
Just a thought... we may want to consider adding a custom
|
@jasnell hm, thanks for raising that up, but we need to be careful about the format we pick since people may store them into DB or send them to clients that are not implemented in JavaScript... |
On a second thought, the ES6 classes probably does not worth making this semver major. I have changed it back to the ES5 way of doing things. @jasnell |
EDIT: forgot to push. New CI https://ci.nodejs.org/job/node-test-pull-request/15645/ |
Ping @jasnell does this look good to you now as a non-semver-major? |
Yes, looks good |
Previous CI is inaccessible, new CI: https://ci.nodejs.org/job/node-test-pull-request/15855/ |
Looks like it broke something related to #13255 on Windows, I'll investigate. Failures in job https://ci.nodejs.org/job/node-test-pull-request/15920/ debian8-x86See failures on test-softlayer-debian8-x86-1:
ubuntu1404-32See failures on test-digitalocean-ubuntu1404-x86-1:
ubuntu1604-32See failures on test-digitalocean-ubuntu1604-x86-2:
COMPILED_BY=vs2017,RUNNER=win10,RUN_SUBSET=3See failures on test-azure_msft-win10-x64-3:
COMPILED_BY=vs2017,RUNNER=win2008r2-vs2017,RUN_SUBSET=3See failures on test-rackspace-win2008r2-x64-3:
COMPILED_BY=vs2017,RUNNER=win2016,RUN_SUBSET=3See failures on test-azure_msft-win2016-x64-3:
COMPILED_BY=vs2017-x86,RUNNER=win2012r2,RUN_SUBSET=3See failures on test-rackspace-win2012r2-x64-1:
|
Won't be able to be around a machine to look into this this week |
What's the status on this one? |
Can we try fixing merge conflicts and running the tests again? I'd be happy to give it a shot in another pull request |
- Extend the aliased buffer for stats objects to contain the entire time spec (seconds and nanoseconds) for the time values instead of calculating the milliseconds in C++ and lose precision there. - Calculate the nanosecond-precision time values in JS and expose them in BigInt Stats objects as `*timeNs`. The millisecond-precision values are now calculated from the nanosecond-precision values.
stats[3 + offset], stats[4 + offset], stats[5 + offset], | ||
stats[6 + offset], stats[7 + offset], stats[8 + offset], | ||
stats[9 + offset], | ||
msFromTimeSpec(stats[10 + offset], stats[11 + offset]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't pass a time spec into the Stats
constructor as that would be a breaking change since Stats
is public. We may try using some factory function to construct Stats
internally from time specs later, and try adding the Ns properties to normal Stats later, though, but there will be some precision losses without bigint and that's not too different from multiplying the Ms ones with 1000
The CI is now green (minus an unrelated failure #27611 ) @jasnell @Fishrock123 can you please take a look again? Also @devsnek this might be useful for #27850 , whichever lands first.. |
@@ -726,6 +731,54 @@ added: v8.1.0 | |||
The timestamp indicating the creation time of this file expressed in | |||
milliseconds since the POSIX Epoch. | |||
|
|||
### stats.atimeNs | |||
<!-- YAML | |||
added: REPLACEME |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be changed, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That'll only be available when this is released.
Landed in b245257 |
- Extend the aliased buffer for stats objects to contain the entire time spec (seconds and nanoseconds) for the time values instead of calculating the milliseconds in C++ and lose precision there. - Calculate the nanosecond-precision time values in JS and expose them in BigInt Stats objects as `*timeNs`. The millisecond-precision values are now calculated from the nanosecond-precision values. PR-URL: #21387 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
- Extend the aliased buffer for stats objects to contain the entire time spec (seconds and nanoseconds) for the time values instead of calculating the milliseconds in C++ and lose precision there. - Calculate the nanosecond-precision time values in JS and expose them in BigInt Stats objects as `*timeNs`. The millisecond-precision values are now calculated from the nanosecond-precision values. PR-URL: #21387 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
- Extend the aliased buffer for stats objects to contain the entire time spec (seconds and nanoseconds) for the time values instead of calculating the milliseconds in C++ and lose precision there. - Calculate the nanosecond-precision time values in JS and expose them in BigInt Stats objects as `*timeNs`. The millisecond-precision values are now calculated from the nanosecond-precision values. PR-URL: #21387 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
Notable changes: * deps: * Update npm to 6.10.3 (isaacs) #29023 * fs: * Add recursive option to rmdir() (cjihrig) #29168 * Allow passing true to emitClose option (Giorgos Ntemiris) #29212 * Add \*timeNs properties to BigInt Stats objects (Joyee Cheung) #21387 * net: * Allow reading data into a static buffer (Brian White) #25436 PR-URL: #29429
Notable changes: * deps: * Update npm to 6.10.3 (isaacs) #29023 * fs: * Add recursive option to rmdir() (cjihrig) #29168 * Allow passing true to emitClose option (Giorgos Ntemiris) #29212 * Add \*timeNs properties to BigInt Stats objects (Joyee Cheung) #21387 * net: * Allow reading data into a static buffer (Brian White) #25436 PR-URL: #29429
Notable changes: * deps: * Update npm to 6.10.3 (isaacs) #29023 * fs: * Add recursive option to rmdir() (cjihrig) #29168 * Allow passing true to emitClose option (Giorgos Ntemiris) #29212 * Add \*timeNs properties to BigInt Stats objects (Joyee Cheung) #21387 * net: * Allow reading data into a static buffer (Brian White) #25436 PR-URL: #29429
the entire time spec (seconds and nanoseconds) for the time
values instead of calculating the milliseconds in C++ and
lose precision.
them in BigInt Stats objects as
*timeNs
. Themillisecond-precision values are now calculated from the
nanosecond-precision values.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes