diff options
author | cjihrig <cjihrig@gmail.com> | 2019-03-31 17:33:23 +0300 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2019-04-23 00:10:57 +0300 |
commit | af35d4044fd32922ce784afa6da98520ffbbf872 (patch) | |
tree | 471a4d4da7ee5008ef82b20dad982f939dff31da /src/node_report.cc | |
parent | 90cf2d5f008b59ee0cbe881b1835eaf6a6a77fe2 (diff) |
report: use uv_gettimeofday for dumpEventTimeStamp
dumpEventTimeStamp was not implemented on Windows, and did not
include any error checking. This commit adds Windows support
and error checking.
PR-URL: https://github.com/nodejs/node/pull/27029
Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'src/node_report.cc')
-rw-r--r-- | src/node_report.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/node_report.cc b/src/node_report.cc index 74391cd4c1b..8a257b0c9c6 100644 --- a/src/node_report.cc +++ b/src/node_report.cc @@ -209,11 +209,14 @@ static void WriteNodeReport(Isolate* isolate, tm_struct.tm_min, tm_struct.tm_sec); writer.json_keyvalue("dumpEventTime", timebuf); - struct timeval ts; - gettimeofday(&ts, nullptr); - writer.json_keyvalue("dumpEventTimeStamp", - std::to_string(ts.tv_sec * 1000 + ts.tv_usec / 1000)); #endif + + uv_timeval64_t ts; + if (uv_gettimeofday(&ts) == 0) { + writer.json_keyvalue("dumpEventTimeStamp", + std::to_string(ts.tv_sec * 1000 + ts.tv_usec / 1000)); + } + // Report native process ID writer.json_keyvalue("processId", pid); |