Skip to content

Commit

Permalink
Fix timeouts with floating point numbers bug
Browse files Browse the repository at this point in the history
fixes #897.
  • Loading branch information
ry committed Apr 22, 2011
1 parent 3ce5e6f commit c8e447e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ int Start (int argc, char *argv[]);

/* Converts a unixtime to V8 Date */
#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) \
(target)->Set(v8::String::NewSymbol(#constant), \
Expand Down
14 changes: 14 additions & 0 deletions test/simple/test-regress-GH-897.js
Original file line number Diff line number Diff line change
@@ -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);
});

0 comments on commit c8e447e

Please sign in to comment.