node_patches/node8.9.3_modified/src/node.cc
// Hrtime exposes libuv's uv_hrtime() high-resolution timer.
// The value returned by uv_hrtime() is a 64-bit int representing nanoseconds,
// so this function instead fills in an Uint32Array with 3 entries,
// to avoid any integer overflow possibility.
// The first two entries contain the second part of the value
// broken into the upper/lower 32 bits to be converted back in JS,
// because there is no Uint64Array in JS.
// The third entry contains the remaining nanosecond part of the value.
Hrtime exposes libuv's uv_hrtime() high-resolution timer.
The value returned by uv_hrtime() is a 64-bit int representing nanoseconds,
so this function instead fills in an Uint32Array with 3 entries,
to avoid any integer overflow possibility.
The first two entries contain the second part of the value
broken into the upper/lower 32 bits to be converted back in JS,
because there is no Uint64Array in JS.
The third entry contains the remaining nanosecond part of the value.
Hrtime exposes libuv ' s uv_hrtime () high - resolution timer . The value returned by uv_hrtime () is a 64 - bit int representing nanoseconds so this function instead fills in an Uint32Array with 3 entries to avoid any integer overflow possibility . The first two entries contain the second part of the value broken into the upper / lower 32 bits to be converted back in JS because there is no Uint64Array in JS . The third entry contains the remaining nanosecond part of the value .
static void Hrtime(const FunctionCallbackInfo<Value>& args) {
  uint64_t t = uv_hrtime();
  Local<ArrayBuffer> ab = args[0].As<Uint32Array>()->Buffer();
  uint32_t* fields = static_cast<uint32_t*>(ab->GetContents().Data());
  fields[0] = (t / NANOS_PER_SEC) >> 32;
  fields[1] = (t / NANOS_PER_SEC) & 0xffffffff;
  fields[2] = t % NANOS_PER_SEC;
}
static void Hrtime ( const FunctionCallbackInfo < Value > & args ) { uint64_t t = uv_hrtime ( ) ; Local < ArrayBuffer > ab = args [ 0 ] . As < Uint32Array > ( ) -> Buffer ( ) ; uint32_t * fields = static_cast < uint32_t * > ( ab -> GetContents ( ) . Data ( ) ) ; fields [ 0 ] = ( t / NANOS_PER_SEC ) >> 32 ; fields [ 1 ] = ( t / NANOS_PER_SEC ) & 0xffffffff ; fields [ 2 ] = t % NANOS_PER_SEC ; }
Hrtime exposes libuv's uv_hrtime() high-resolution timer.
Hrtime exposes libuv ' s uv_hrtime () high - resolution timer .