schedule的开始时间设置的是一个固定时间,比如中午12点,如果过了12点启动,那么会立刻执行一次,有没有办法能过了任务的指定开始时间就不执行了等下一次?
ringa_lee2017-04-18 10:00:53
public void schedule(TimerTask task, long delay, long period)
Isn’t it possible to use this interface? Calculate the number of milliseconds from the current time to 12 noon delay
,period
是今天中午12点至明天中午12点就是24小时的毫秒数。这样如果当前时间超过12点了。那delay
and it will be the next 12 o'clock.
巴扎黑2017-04-18 10:00:53
Can you add a method to judge whether the current time is not equal to the scheduled time and not start it? I have never done this...