Skip to content

Instantly share code, notes, and snippets.

@azugxi7374
Created September 27, 2016 13:45
Show Gist options
  • Save azugxi7374/a5f2f5b01210b3bbb76015b833c23544 to your computer and use it in GitHub Desktop.
Save azugxi7374/a5f2f5b01210b3bbb76015b833c23544 to your computer and use it in GitHub Desktop.
Dateのやつ
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