Browse Source

Fix timeouts with floating point numbers bug

fixes #897.
v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
c8e447ee63
  1. 2
      src/node.h
  2. 14
      test/simple/test-regress-GH-897.js

2
src/node.h

@ -43,7 +43,7 @@ int Start (int argc, char *argv[]);
/* Converts a unixtime to V8 Date */ /* Converts a unixtime to V8 Date */
#define NODE_UNIXTIME_V8(t) v8::Date::New(1000*static_cast<double>(t)) #define NODE_UNIXTIME_V8(t) v8::Date::New(1000*static_cast<double>(t))
#define NODE_V8_UNIXTIME(v) (static_cast<double>((v)->IntegerValue())/1000.0); #define NODE_V8_UNIXTIME(v) (static_cast<double>((v)->NumberValue())/1000.0);
#define NODE_DEFINE_CONSTANT(target, constant) \ #define NODE_DEFINE_CONSTANT(target, constant) \
(target)->Set(v8::String::NewSymbol(#constant), \ (target)->Set(v8::String::NewSymbol(#constant), \

14
test/simple/test-regress-GH-897.js

@ -0,0 +1,14 @@
var common = require('../common');
var assert = require('assert');
var t = Date.now();
var diff;
setTimeout(function () {
diff = Date.now() - t;
console.error(diff);
}, 0.1);
process.on('exit', function() {
assert.ok(diff < 10);
});
Loading…
Cancel
Save