defensive programming for time_period