public void execute(int hour){ long t1 = System.currentTimeMillis(); while(true){ long t2 = System.currentTimeMillis(); if(t2-t1 > hour*60*60*1000){ break; }else{ //TODO your work } } }
时间: 2024-11-10 01:21:06
public void execute(int hour){ long t1 = System.currentTimeMillis(); while(true){ long t2 = System.currentTimeMillis(); if(t2-t1 > hour*60*60*1000){ break; }else{ //TODO your work } } }