休眠到指定时分秒

private int GetSleepTime(int hour, int min, int second){
     var now = DateTime.Now;
     int sleep = (((hour - now.Hour) * 60 + (min - now.Minute)) * 60 + (second - now.Second)) * 1000;
     if (sleep < 0){
        sleep += 24 * 3600 * 1000;
    }
     return sleep;
 }

  

posted @ 2016-10-20 08:48  NoRoadZH  阅读(234)  评论(0编辑  收藏  举报