MCPcopy Index your code
hub / github.com/nodejs/node / toUnixTimestamp

Function toUnixTimestamp

lib/internal/fs/utils.js:783–799  ·  view source on GitHub ↗
(time, name = 'time')

Source from the content-addressed store, hash-verified

781
782// converts Date or number to a fractional UNIX timestamp
783function 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
801const validateOffsetLengthRead = hideStackFrames(
802 (offset, length, bufferLength) => {

Callers 9

utimesFunction · 0.85
utimesSyncFunction · 0.85
futimesFunction · 0.85
futimesSyncFunction · 0.85
lutimesFunction · 0.85
lutimesSyncFunction · 0.85
utimesFunction · 0.85
futimesFunction · 0.85
lutimesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…