| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6293aea commit 8163f31
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,28 +7,20 @@ const { | |||
| 7 | 7 | const { setUnrefTimeout } = require('internal/timers'); | |
| 8 | 8 | const { PerformanceEntry, notify } = internalBinding('performance'); | |
| 9 | 9 | ||
| 10 | - let nowCache; | ||
| 11 | 10 | let utcCache; | |
| 12 | 11 | ||
| 13 | - function nowDate() { | ||
| 14 | - if (!nowCache) cache(); | ||
| 15 | - return nowCache; | ||
| 16 | - } | ||
| 17 | - | ||
| 18 | 12 | function utcDate() { | |
| 19 | 13 | if (!utcCache) cache(); | |
| 20 | 14 | return utcCache; | |
| 21 | 15 | } | |
| 22 | 16 | ||
| 23 | 17 | function cache() { | |
| 24 | 18 | const d = new Date(); | |
| 25 | - nowCache = d.valueOf(); | ||
| 26 | 19 | utcCache = d.toUTCString(); | |
| 27 | 20 | setUnrefTimeout(resetCache, 1000 - d.getMilliseconds()); | |
| 28 | 21 | } | |
| 29 | 22 | ||
| 30 | 23 | function resetCache() { | |
| 31 | - nowCache = undefined; | ||
| 32 | 24 | utcCache = undefined; | |
| 33 | 25 | } | |
| 34 | 26 | ||
@@ -51,7 +43,6 @@ function emitStatistics(statistics) { | |||
| 51 | 43 | module.exports = { | |
| 52 | 44 | kOutHeaders: Symbol('kOutHeaders'), | |
| 53 | 45 | kNeedDrain: Symbol('kNeedDrain'), | |
| 54 | - nowDate, | ||
| 55 | 46 | utcDate, | |
| 56 | 47 | emitStatistics | |
| 57 | 48 | }; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments