mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
9ea363ee99
PR-URL: https://github.com/nodejs/node/pull/14239 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
28 lines
511 B
JavaScript
Executable File
28 lines
511 B
JavaScript
Executable File
'use strict';
|
|
|
|
const timers = require('timers');
|
|
|
|
var dateCache;
|
|
function utcDate() {
|
|
if (!dateCache) {
|
|
const d = new Date();
|
|
dateCache = d.toUTCString();
|
|
timers.enroll(utcDate, 1000 - d.getMilliseconds());
|
|
timers._unrefActive(utcDate);
|
|
}
|
|
return dateCache;
|
|
}
|
|
utcDate._onTimeout = function() {
|
|
dateCache = undefined;
|
|
};
|
|
|
|
function ondrain() {
|
|
if (this._httpMessage) this._httpMessage.emit('drain');
|
|
}
|
|
|
|
module.exports = {
|
|
outHeadersKey: Symbol('outHeadersKey'),
|
|
ondrain,
|
|
utcDate
|
|
};
|