return promise;
}
-#define NODE_UNIXTIME(t) v8::Date::New(1000*static_cast<double>(t))
int
EIOPromise::After (eio_req *req)
{
stats->Set(SIZE_SYMBOL, Integer::New(s->st_size)); /* total size, in bytes */
stats->Set(BLKSIZE_SYMBOL, Integer::New(s->st_blksize)); /* blocksize for filesystem I/O */
stats->Set(BLOCKS_SYMBOL, Integer::New(s->st_blocks)); /* number of blocks allocated */
- stats->Set(ATIME_SYMBOL, NODE_UNIXTIME(s->st_atime)); /* time of last access */
- stats->Set(MTIME_SYMBOL, NODE_UNIXTIME(s->st_mtime)); /* time of last modification */
- stats->Set(CTIME_SYMBOL, NODE_UNIXTIME(s->st_ctime)); /* time of last status change */
+ stats->Set(ATIME_SYMBOL, NODE_UNIXTIME_V8(s->st_atime)); /* time of last access */
+ stats->Set(MTIME_SYMBOL, NODE_UNIXTIME_V8(s->st_mtime)); /* time of last modification */
+ stats->Set(CTIME_SYMBOL, NODE_UNIXTIME_V8(s->st_ctime)); /* time of last status change */
argc = 1;
argv[0] = stats;
break;
Connection *connection = ObjectWrap::Unwrap<Connection>(args.This());
assert(connection);
- float timeout = (float)(args[0]->IntegerValue()) / 1000;
+ float timeout = NODE_V8_UNIXTIME(args[0]);
connection->SetTimeout(timeout);
namespace node {
+/* Converts a unixtime to V8 Date */
+#define NODE_UNIXTIME_V8(t) v8::Date::New(1000*static_cast<double>(t))
+#define NODE_V8_UNIXTIME(v) ((double)((v)->IntegerValue())/1000.0);
+
#define NODE_DEFINE_CONSTANT(target, constant) \
(target)->Set(v8::String::NewSymbol(#constant), \
v8::Integer::New(constant))
assert(timer);
assert(property == REPEAT_SYMBOL);
- timer->watcher_.repeat = (double)(value->IntegerValue()) / 1000;
+ timer->watcher_.repeat = NODE_V8_UNIXTIME(value);
}
void
if (args.Length() != 2)
return ThrowException(String::New("Bad arguments"));
- ev_tstamp after = (double)(args[0]->IntegerValue()) / 1000.0;
- ev_tstamp repeat = (double)(args[1]->IntegerValue()) / 1000.0;
+ ev_tstamp after = NODE_V8_UNIXTIME(args[0]);
+ ev_tstamp repeat = NODE_V8_UNIXTIME(args[1]);
ev_timer_init(&timer->watcher_, Timer::OnTimeout, after, repeat);
timer->watcher_.data = timer;