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 } } }
时间: 2025-01-16 07:42:33
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 } } }