Inserted function isTimeFinite to check if time is infinite or not