function sleep(milisecond) {
var currentDate, beginDate = new Date();
var beginHour, beginMinute, beginSecond, beginMs;
var hourGaps, minuteGaps, secondGaps, msGaps, gaps;
beginHour = beginDate.getHours();
beginMinute = beginDate.getMinutes();
beginSecond = beginDate.getSeconds();
beginMs = beginDate.getMilliseconds();
do {
currentDate = new Date();
hourGaps = currentDate.getHours() - beginHour;
minuteGaps = currentDate.getMinutes() - beginMinute;
secondGaps = currentDate.getSeconds() - beginSecond;
msGaps = currentDate.getMilliseconds() - beginMs;
if (hourGaps < 0) hourGaps += 24; //考虑进时进分进秒的特殊情况
gaps = hourGaps * 3600 + minuteGaps * 60 + secondGaps;
gaps = gaps * 1000 + msGaps;
} while (gaps < milisecond);
}