def read_times_file(file):
    """
        Read a RVGL .times file and return a list of times. Only returns valid
        times. Each element of the list a dict with the keys 'time' (in ms),
        'profile' (str) and 'car' (str).
    """
    times = []
    with open(file, 'rb') as f:

        # Skip first line (no data for some reason)
        buf = bytes(f.read(40))

        buf = bytes(f.read(40))
        while len(buf) == 40:
            time = {}
            time['time'] = buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24);
            time['profile'] = str(buf[4:20], 'ascii').rstrip('\0')
            time['car'] = str(buf[20:40], 'ascii').rstrip('\0')

            if time['time'] != 1800000:
                times.append(time)

            buf = bytes(f.read(40))
    return times