def get_next_invalid_time_from_t(self, timestamp):
        timestamp = int(timestamp)
        original_t = timestamp
        dr_mins = []
        for daterange in self.dateranges:
            timestamp = original_t
            cont = True
            while cont:
                start = daterange.get_next_valid_time_from_t(timestamp)
                if start is not None:
                    end = daterange.get_next_invalid_time_from_t(start)
                    dr_mins.append((start, end))
                    timestamp = end
                else:
                    cont = False
                if timestamp > original_t + (3600 * 24 * 365):
                    cont = False
        periods = merge_periods(dr_mins)
        dr_mins = []
        for exclude in self.exclude:
            for daterange in exclude.dateranges:
                timestamp = original_t
                cont = True
                while cont:
                    start = daterange.get_next_valid_time_from_t(timestamp)
                    if start is not None:
                        end = daterange.get_next_invalid_time_from_t(start)
                        dr_mins.append((start, end))
                        timestamp = end
                    else:
                        cont = False
                    if timestamp > original_t + (3600 * 24 * 365):
                        cont = False
        if not dr_mins:
            periods_exclude = []
        else:
            periods_exclude = merge_periods(dr_mins)
        if len(periods) >= 1:
            if periods[0][0] > original_t:
                return original_t
            if len(periods_exclude) >= 1:
                if periods_exclude[0][0] < periods[0][1]:
                    return periods_exclude[0][0]
            return periods[0][1]
        return original_t