def _convert_timestr_to_seconds(time_str, rec_start):
    if not CHECK_TIME_STR.match(time_str):
        raise ValueError('Input can only contain digits and colons')
    if ':' in time_str:
        time_split = [int(x) for x in time_str.split(':')]
        if len(time_split) == 2:
            time_split.append(0)
        clock_time = time(*time_split)
        chosen_start = datetime.combine(rec_start.date(), clock_time)
        if clock_time < rec_start.time():
            chosen_start += timedelta(days=1)
        window_start = int((chosen_start - rec_start).total_seconds())
    else:
        window_start = int(time_str)
    return window_start