diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2018-06-18 21:58:49 +0300 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2019-06-13 22:24:41 +0300 |
commit | b245257b70750bdc52a8c315de4b10965dacfed6 (patch) | |
tree | 004c92ceffe5f568ec5d06b592aaa38b157c80fe /src/node_file.cc | |
parent | 4b1bcae681e209984604341f2acfe722345b1b23 (diff) |
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.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/node_file.cc b/src/node_file.cc index 8f82d639d6d..564c63bad73 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"), |