summaryrefslogtreecommitdiff
path: root/src/node.h
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2018-09-30 12:48:34 -0400
committerDaniel Bevenius <daniel.bevenius@gmail.com>2018-10-04 08:02:59 +0200
commitac54469cc6ba1cbaf84d526d10b0394436af79b0 (patch)
tree2969c371b93699de42704a631913ca0b4dbc2d69 /src/node.h
parentcd40d7afac2554ec2d2c213cdab31f0ac6398736 (diff)
downloadnode-new-ac54469cc6ba1cbaf84d526d10b0394436af79b0.tar.gz
src: deprecate V8 date conversion helpers
These helpers provide no benefit over the existing V8 API, and at least one of them fetches the current `Isolate` through `Isolate::GetCurrent()` (which should be avoided). PR-URL: https://github.com/nodejs/node/pull/23179 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node.h')
-rw-r--r--src/node.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/node.h b/src/node.h
index eceabdc4e3..7373e84048 100644
--- a/src/node.h
+++ b/src/node.h
@@ -289,9 +289,16 @@ NODE_EXTERN void RunAtExit(Environment* env);
NODE_EXTERN struct uv_loop_s* GetCurrentEventLoop(v8::Isolate* isolate);
/* Converts a unixtime to V8 Date */
-#define NODE_UNIXTIME_V8(t) v8::Date::New(v8::Isolate::GetCurrent(), \
- 1000 * static_cast<double>(t))
-#define NODE_V8_UNIXTIME(v) (static_cast<double>((v)->NumberValue())/1000.0);
+NODE_DEPRECATED("Use v8::Date::New() directly",
+ inline v8::Local<v8::Value> NODE_UNIXTIME_V8(double time) {
+ return v8::Date::New(v8::Isolate::GetCurrent(), 1000 * time);
+})
+#define NODE_UNIXTIME_V8 node::NODE_UNIXTIME_V8
+NODE_DEPRECATED("Use v8::Date::ValueOf() directly",
+ inline double NODE_V8_UNIXTIME(v8::Local<v8::Date> date) {
+ return date->ValueOf() / 1000;
+})
+#define NODE_V8_UNIXTIME node::NODE_V8_UNIXTIME
#define NODE_DEFINE_CONSTANT(target, constant) \
do { \