代码是从大佬的v_jstool 里扣出来的
// ftime 为固定的时间
const ftime = 123
Date = function (_Date) {
var bind = Function.bind;
var unbind = bind.bind(bind);
function instantiate(constructor, args) {
return new (unbind(constructor, null).apply(null, args));
}
var names = Object.getOwnPropertyNames(_Date);
for (var i = 0; i < names.length; i++) {
if (names[i] in Date)
continue;
var desc = Object.getOwnPropertyDescriptor(_Date, names[i]);
Object.defineProperty(Date, names[i], desc);
}
function Date() {
var date = instantiate(_Date, [ftime]); // 固定返回某一个时间点
return date;
}
Date.prototype = _Date.prototype
return Date
}(Date);
Date.now = function now() { return ftime }