def get_raw_times(times, starttime, endtime):
    """
    Return list of times covering only the relevant time range.

    times - all times in input file
    starttime, endtime - relevant time range
    """
    i_min, i_max = 0, len(times) - 1
    for (i, time) in enumerate(times):
        if time < starttime:
            i_min = i
        elif time > endtime:
            i_max = i
            break
    return times[i_min: i_max + 1]