diff --git a/src/node.cc b/src/node.cc index 8095ea63cd..b625803a3d 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1,6 +1,8 @@ // Copyright 2009 Ryan Dahl #include +#include + #include #include #include @@ -533,6 +535,13 @@ static Handle SetUid(const Arguments& args) { return Undefined(); } +Handle +NowGetter (Local property, const AccessorInfo& info) +{ + HandleScope scope; + return scope.Close(Integer::New(ev_now(EV_DEFAULT_UC))); +} + v8::Handle Exit(const v8::Arguments& args) { HandleScope scope; @@ -1003,6 +1012,8 @@ static void Load(int argc, char *argv[]) { Local process_template = FunctionTemplate::New(); node::EventEmitter::Initialize(process_template); + process_template->InstanceTemplate()->SetAccessor(String::NewSymbol("now"), NowGetter, NULL); + process = Persistent::New(process_template->GetFunction()->NewInstance()); // Add a reference to the global object