Skip to content

Commit ca6b9ff

Browse files
committed
Node 0.6 support
1 parent fa32422 commit ca6b9ff

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/integration2/hook.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,20 @@ var ORM = require('../../');
77
describe("Hook", function() {
88
var db = null;
99
var Person = null;
10-
1110
var triggeredHooks = {};
11+
var getTimestamp; // Calling it 'getTime' causes strangeness.
12+
13+
if (process.hrtime) {
14+
getTimestamp = function () { return parseFloat(process.hrtime().join('.')); };
15+
} else {
16+
getTimestamp = function () { return Date.now(); };
17+
}
1218

1319
var checkHook = function (hook) {
1420
triggeredHooks[hook] = false;
1521

1622
return function () {
17-
triggeredHooks[hook] = parseFloat(process.hrtime().join('.'));
23+
triggeredHooks[hook] = getTimestamp();
1824
};
1925
};
2026

0 commit comments

Comments
 (0)