def get_next_item_occurrences_UTC(base_time, utcbase, utcoffset, filename, id_, rule, occs): limits = occs.get_item_time_span(filename, id_) if limits: minstart, maxend = limits interval = rule['#'][1] rend = rule['#'][4] inclusive = rule['#'][5] # start can't be based on base_time, in fact an except rule can affect # an occurrence even if its start and end times are out of the time # range start = occur_regularly.compute_min_time(minstart, rule['#'][0], interval, rule['#'][2], rule['#'][3]) # Because of the start time note above, this loop will take a long time # to complete for wide search ranges and short intervals (bug #329) while True: end = start + rend next_occ = occs.get_next_occurrence_time() if not next_occ or start > next_occ: break if start <= maxend and end >= minstart: # The rule is checked in make_rule, no need to use occs.except_ occs.except_safe(filename, id_, start, end, inclusive) start += interval
def get_occurrences_range_UTC(mint, utcmint, maxt, utcoffset, filename, id_, rule, occs): limits = occs.get_item_time_span(filename, id_) if limits: minstart, maxend = limits interval = rule['#'][1] rend = rule['#'][4] inclusive = rule['#'][5] # start can't be based on mint, in fact an except rule can affect an # occurrence even if its start and end times are out of the time range start = occur_regularly.compute_min_time(minstart, rule['#'][0], interval, rule['#'][2], rule['#'][3]) # Because of the start time note above, this loop will take a long time # to complete for example when retrieving the old alarms, and such a # search couldn't be aborted, since the aborting happens there, not in # this loop (bug #329) while True: end = start + rend if start > maxend: break elif end >= minstart: # The rule is checked in make_rule, no need to use occs.except_ occs.except_safe(filename, id_, start, end, inclusive) start += interval
def get_next_item_occurrences_local(base_time, utcbase, utcoffset, filename, id_, rule, occs): limits = occs.get_item_time_span(filename, id_) if limits: minstart, maxend = limits interval = rule['#'][1] rend = rule['#'][4] inclusive = rule['#'][5] # start can't be based on base_time, in fact an except rule can affect # an occurrence even if its start and end times are out of the time # range # Subtract utcoffset.compute(minstart) because in Western (negative) # time zones (e.g. Pacific/Honolulu), the first occurrence to be found # would otherwise be already too late; in Eastern (positive) time # zones the problem would pass unnoticed because the first occurrence # would be found too early, and simply several cycles would not # produce occurrences in the search range start = occur_regularly.compute_min_time( minstart - utcoffset.compute(minstart), rule['#'][0], interval, rule['#'][2], rule['#'][3]) # Because of the start time note above, this loop will take a long time # to complete for wide search ranges and short intervals (bug #329) while True: # Every timestamp can have a different UTC offset, depending # whether it's in a DST period or not offset = utcoffset.compute(start) sstart = start + offset send = sstart + rend next_occ = occs.get_next_occurrence_time() # Do compare sstart with next_occ, *not* start if not next_occ or sstart > next_occ: break # Do compare sstart with maxend and send with minstart, *not* start # and end if sstart <= maxend and send >= minstart: # The rule is checked in make_rule, no need to use occs.except_ occs.except_safe(filename, id_, sstart, send, inclusive) start += interval
def get_next_item_occurrences_local(base_time, utcbase, utcoffset, filename, id_, rule, occs): limits = occs.get_item_time_span(filename, id_) if limits: minstart, maxend = limits interval = rule['#'][1] rend = rule['#'][4] inclusive = rule['#'][5] # start can't be based on base_time, in fact an except rule can affect # an occurrence even if its start and end times are out of the time # range # Subtract utcoffset.compute(minstart) because in Western (negative) # time zones (e.g. Pacific/Honolulu), the first occurrence to be found # would otherwise be already too late; in Eastern (positive) time # zones the problem would pass unnoticed because the first occurrence # would be found too early, and simply several cycles would not # produce occurrences in the search range start = occur_regularly.compute_min_time(minstart - utcoffset.compute( minstart), rule['#'][0], interval, rule['#'][2], rule['#'][3]) # Because of the start time note above, this loop will take a long time # to complete for wide search ranges and short intervals (bug #329) while True: # Every timestamp can have a different UTC offset, depending # whether it's in a DST period or not offset = utcoffset.compute(start) sstart = start + offset send = sstart + rend next_occ = occs.get_next_occurrence_time() # Do compare sstart with next_occ, *not* start if not next_occ or sstart > next_occ: break # Do compare sstart with maxend and send with minstart, *not* start # and end if sstart <= maxend and send >= minstart: # The rule is checked in make_rule, no need to use occs.except_ occs.except_safe(filename, id_, sstart, send, inclusive) start += interval