summaryrefslogtreecommitdiff
path: root/src/node_file.cc
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2018-06-19 02:58:49 +0800
committerJoyee Cheung <joyeec9h3@gmail.com>2019-06-14 03:24:41 +0800
commitb245257b70750bdc52a8c315de4b10965dacfed6 (patch)
tree004c92ceffe5f568ec5d06b592aaa38b157c80fe /src/node_file.cc
parent4b1bcae681e209984604341f2acfe722345b1b23 (diff)
downloadandroid-node-v8-b245257b70750bdc52a8c315de4b10965dacfed6.tar.gz
android-node-v8-b245257b70750bdc52a8c315de4b10965dacfed6.tar.bz2
android-node-v8-b245257b70750bdc52a8c315de4b10965dacfed6.zip
fs: add *timeNs properties to BigInt Stats objects
- 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: https://github.com/nodejs/node/pull/21387 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
Diffstat (limited to 'src/node_file.cc')
-rw-r--r--src/node_file.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/node_file.cc b/src/node_file.cc
index 8f82d639d6..564c63bad7 100644
--- a/src/node_file.cc
+++ b/src/node_file.cc
@@ -2197,10 +2197,13 @@ void Initialize(Local<Object> target,
env->SetMethod(target, "mkdtemp", Mkdtemp);
- target->Set(context,
- FIXED_ONE_BYTE_STRING(isolate, "kFsStatsFieldsNumber"),
- Integer::New(isolate, kFsStatsFieldsNumber))
- .Check();
+ target
+ ->Set(context,
+ FIXED_ONE_BYTE_STRING(isolate, "kFsStatsFieldsNumber"),
+ Integer::New(
+ isolate,
+ static_cast<int32_t>(FsStatsOffset::kFsStatsFieldsNumber)))
+ .Check();
target->Set(context,
FIXED_ONE_BYTE_STRING(isolate, "statValues"),