Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy J Fontaine <tjfontaine@gmail.com>2013-05-22 22:32:54 +0400
committerTimothy J Fontaine <tjfontaine@gmail.com>2013-05-23 07:13:14 +0400
commitf8193ab3c46475486eab38543650e2388bd3aedc (patch)
tree340e802e74b622c800254761352d3c91c028b74f /lib/tls.js
parentf58eb8f5dbe5e530f1e37fc6978fdf853be81706 (diff)
timers: use uv_now instead of Date.now
This saves a few calls to gettimeofday which can be expensive, and potentially subject to clock drift. Instead use the loop time which uses hrtime internally. fixes #5497
Diffstat (limited to 'lib/tls.js')
-rw-r--r--lib/tls.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/tls.js b/lib/tls.js
index 3af078a966e..cc71bd97618 100644
--- a/lib/tls.js
+++ b/lib/tls.js
@@ -28,6 +28,8 @@ var stream = require('stream');
var assert = require('assert').ok;
var constants = require('constants');
+var Timer = process.binding('timer_wrap').Timer;
+
var DEFAULT_CIPHERS = 'ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:' + // TLS 1.2
'RC4:HIGH:!MD5:!aNULL:!EDH'; // TLS 1.0
@@ -720,7 +722,7 @@ function onhandshakestart() {
var self = this;
var ssl = self.ssl;
- var now = Date.now();
+ var now = Timer.now();
assert(now >= ssl.lastHandshakeTime);