Utilizing Date.now()
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by visionmedia · committed by visionmedia · parent 8b58732 · Browse files · 3 files·+8 added−8 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+8 added−8 removed
- other:+8 added−8 removed
Provenance
- Commit
3cc7b4d- Tree
3c92146- Author
visionmedia <tj@vision-media.ca>- Committer
visionmedia <tj@vision-media.ca>- Parent
8b58732
3 files changed+8 added−8 removed
modified:lib/express/plugins/cache.js+2 added-2 removed
16 unmodified lines17 18 constructor: function(key, val) {19 this.key = key20 this.val = val21- this.created = Number(new Date)21+ this.created = Date.now()22 }23 })24 25 // --- Store142 unmodified lines168 */169 170 reap: function(ms, callback) {171 var self = this,172- threshold = Number(new Date(Number(new Date) - ms))172+ threshold = +new Date(Date.now() - ms)173 this.data.each(function(cache){174 if (cache.created < threshold)175 self.clear(cache.key, function(){})176 })58 unmodified linesmodified:lib/express/plugins/logger.js+4 added-4 removed
20 unmodified lines212223242525262728293031323334343536373826 unmodified lines6566676869697071727374757677777879808120 unmodified lines event.request.httpVersionMajor, event.request.httpVersionMinor, event.request.response.status, event.request.response.headers['content-length'] || 0, (Number(new Date) - start) / 1000) (Date.now() - start) / 1000) }, combined: function(event, start) { formats.common(event, start) printf(' "%s" "%s"', event.request.headers['referrer'] || event.request.headers['referer'] || '-', event.request.headers['user-agent']) }, plot: function(event, start) { sys.print(Number(new Date) - start) sys.print(Date.now() - start) }}
// --- Logger26 unmodified lines * Start timer. */ request: function(event) { this.start = Number(new Date) this.start = Date.now() }, /** * Output log data. */ response: function(event) { formats[exports.Logger.format || 'common'](event, this.start || Number(new Date)) formats[exports.Logger.format || 'common'](event, this.start || Date.now()) sys.print('\n') } }})No newline at end of fileNo newline at end of filemodified:lib/express/plugins/session.js+2 added-2 removed
26 unmodified lines27 * @api private28 */29 30 touch: function() {31- this.lastAccess = Number(new Date)31+ this.lastAccess = Date.now()32 }33 })34 35 // --- Store103 unmodified lines139 * @api private140 */141 142 reap: function(ms, callback) {143- var threshold = Number(new Date(Number(new Date) - ms))143+ var threshold = +new Date(Date.now() - ms)144 this.store.each(function(session, sid){145 if (session.lastAccess < threshold)146 this.destroy(sid)147 }, this)87 unmodified lines