Instants (in UTC) around the interesting parts of a zone.
(zone)
| 44 | |
| 45 | |
| 46 | def _probe_instants(zone): |
| 47 | """Instants (in UTC) around the interesting parts of a zone.""" |
| 48 | instants = list(FIXED_INSTANTS) |
| 49 | |
| 50 | # Explicit transitions: the first few, and the last ones, which are |
| 51 | # followed by the TZ string. |
| 52 | transitions = list(zone._trans_utc) |
| 53 | for ts in transitions[:3] + transitions[-10:]: |
| 54 | for delta in (-1, 0, 1): |
| 55 | instants.append(_from_timestamp(ts + delta)) |
| 56 | |
| 57 | # Transitions generated from the TZ string in the footer. |
| 58 | if isinstance(zone._tz_after, _TZStr): |
| 59 | std_offset = zone._tz_after.std.utcoff |
| 60 | std_offset = std_offset.days * 86400 + std_offset.seconds |
| 61 | for year in (2040, 2100): |
| 62 | for local_ts in zone._tz_after.transitions(year): |
| 63 | utc_ts = local_ts - std_offset |
| 64 | for delta in (-7201, -3601, -1, 0, 1, 3599, 7199): |
| 65 | instants.append(_from_timestamp(utc_ts + delta)) |
| 66 | |
| 67 | return [instant for instant in instants if instant is not None] |
| 68 | |
| 69 | |
| 70 | def _keys(): |
no test coverage detected