| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7e3ad1b commit d858c95
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,34 +5,25 @@ const { | |||
| 5 | 5 | Date, | |
| 6 | 6 | DatePrototypeGetMilliseconds, | |
| 7 | 7 | DatePrototypeToUTCString, | |
| 8 | - DatePrototypeValueOf, | ||
| 9 | 8 | } = primordials; | |
| 10 | 9 | ||
| 11 | 10 | const { setUnrefTimeout } = require('internal/timers'); | |
| 12 | 11 | const { PerformanceEntry, notify } = internalBinding('performance'); | |
| 13 | 12 | ||
| 14 | - let nowCache; | ||
| 15 | 13 | let utcCache; | |
| 16 | 14 | ||
| 17 | - function nowDate() { | ||
| 18 | - if (!nowCache) cache(); | ||
| 19 | - return nowCache; | ||
| 20 | - } | ||
| 21 | - | ||
| 22 | 15 | function utcDate() { | |
| 23 | 16 | if (!utcCache) cache(); | |
| 24 | 17 | return utcCache; | |
| 25 | 18 | } | |
| 26 | 19 | ||
| 27 | 20 | function cache() { | |
| 28 | 21 | const d = new Date(); | |
| 29 | - nowCache = DatePrototypeValueOf(d); | ||
| 30 | 22 | utcCache = DatePrototypeToUTCString(d); | |
| 31 | 23 | setUnrefTimeout(resetCache, 1000 - DatePrototypeGetMilliseconds(d)); | |
| 32 | 24 | } | |
| 33 | 25 | ||
| 34 | 26 | function resetCache() { | |
| 35 | - nowCache = undefined; | ||
| 36 | 27 | utcCache = undefined; | |
| 37 | 28 | } | |
| 38 | 29 | ||
@@ -55,7 +46,6 @@ function emitStatistics(statistics) { | |||
| 55 | 46 | module.exports = { | |
| 56 | 47 | kOutHeaders: Symbol('kOutHeaders'), | |
| 57 | 48 | kNeedDrain: Symbol('kNeedDrain'), | |
| 58 | - nowDate, | ||
| 59 | 49 | utcDate, | |
| 60 | 50 | emitStatistics | |
| 61 | 51 | }; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments