update time function