-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
src: deprecate V8 date conversion helpers #23179
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -303,9 +303,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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you explain why this is needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because |
||
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 { \ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not equivalent.
In this case I could imagine a user define time related struct, with no implicit cast to
double
, e.g.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While that’s true, I think it’s highly unlikely that such code which uses this method exists.