summaryrefslogtreecommitdiff
path: root/lib/tls.js
diff options
context:
space:
mode:
authorTimothy J Fontaine <tjfontaine@gmail.com>2013-05-22 11:32:54 -0700
committerTimothy J Fontaine <tjfontaine@gmail.com>2013-05-22 20:13:14 -0700
commitf8193ab3c46475486eab38543650e2388bd3aedc (patch)
tree340e802e74b622c800254761352d3c91c028b74f /lib/tls.js
parentf58eb8f5dbe5e530f1e37fc6978fdf853be81706 (diff)
downloadnodejs-f8193ab3c46475486eab38543650e2388bd3aedc.tar.gz
nodejs-f8193ab3c46475486eab38543650e2388bd3aedc.tar.bz2
nodejs-f8193ab3c46475486eab38543650e2388bd3aedc.zip
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 3af078a96..cc71bd976 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);