add time limit function