Created
September 27, 2016 13:45
-
-
Save azugxi7374/a5f2f5b01210b3bbb76015b833c23544 to your computer and use it in GitHub Desktop.
Dateのやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var DT = Date; | |
var ST = setTimeout; | |
function setSpeed(speed){ | |
var p = Date.now(); | |
Date = function dt(t, _month, _day){ | |
if(_month != undefined && _day !=undefined){ | |
return dt(new DT(t, _month, _day).getTime()); | |
} else if(t != undefined){ | |
var now = DT.now(); | |
var diff = t - Date.now(); | |
console.log(p, now, diff); | |
return new DT(Math.floor(p + (now - p + diff)/speed)); | |
} else { | |
var now = DT.now(); | |
return new DT(Math.floor(p + (now - p) * speed)); | |
} | |
}; | |
Date.now = function(){return new Date().getTime();} | |
setTimeout = function(f,t){ return sto(f,t/speed)}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment