(time, name = 'time')
| 781 | |
| 782 | // converts Date or number to a fractional UNIX timestamp |
| 783 | function toUnixTimestamp(time, name = 'time') { |
| 784 | // eslint-disable-next-line eqeqeq |
| 785 | if (typeof time === 'string' && +time == time) { |
| 786 | return +time; |
| 787 | } |
| 788 | if (NumberIsFinite(time)) { |
| 789 | if (time < 0) { |
| 790 | return DateNow() / 1000; |
| 791 | } |
| 792 | return time; |
| 793 | } |
| 794 | if (isDate(time)) { |
| 795 | // Convert to 123.456 UNIX timestamp |
| 796 | return DatePrototypeGetTime(time) / 1000; |
| 797 | } |
| 798 | throw new ERR_INVALID_ARG_TYPE(name, ['Date', 'Time in seconds'], time); |
| 799 | } |
| 800 | |
| 801 | const validateOffsetLengthRead = hideStackFrames( |
| 802 | (offset, length, bufferLength) => { |
no outgoing calls
no test coverage detected
searching dependent graphs…