| 593 | | my $found_gap_match = 0; |
| 594 | | if (defined $gaps->{$prog->{channel}}) { |
| 595 | | foreach my $g (@{($gaps->{$prog->{channel}})}) { |
| 596 | | my ($s, $e) = split(/-/,$g); |
| 597 | | $found_gap_match = 1 if |
| 598 | | ((($s >= $prog->{starttime}) && ($s <= $prog->{stoptime})) || |
| 599 | | (($e >= $prog->{starttime}) && ($e <= $prog->{stoptime})) || |
| 600 | | (($s <= $prog->{starttime}) && ($e >= $prog->{stoptime}))); |
| 601 | | } |
| 602 | | } |
| 603 | | if (!$found_gap_match) { |
| 604 | | $stats{gaps_skipped}++; |
| 605 | | next; |
| 606 | | } else { |
| 607 | | $stats{gaps_included}++; |
| 608 | | } |
| | 596 | next if (!window_is_within_microgap($prog->{starttime},$prog->{stoptime},$this_chan)); |
| | 597 | $stats{gaps_included}++; |
| | 850 | sub window_is_within_microgap |
| | 851 | { |
| | 852 | my ($start, $stop, $channel) = @_; |
| | 853 | |
| | 854 | return window_channel_is_within_microgap($start, $stop, $channel) if (defined $channel); |
| | 855 | |
| | 856 | foreach my $ch (keys %{$channels}) { |
| | 857 | return 1 if window_channel_is_within_microgap($start, $stop, $ch); |
| | 858 | } |
| | 859 | return 0; |
| | 860 | } |
| | 861 | |
| | 862 | sub window_channel_is_within_microgap |
| | 863 | { |
| | 864 | my ($start, $stop, $channel) = @_; |
| | 865 | |
| | 866 | if (defined $gaps->{$channel}) { |
| | 867 | foreach my $g (@{($gaps->{$channel})}) { |
| | 868 | my ($s, $e) = split(/-/,$g); |
| | 869 | return 1 if |
| | 870 | ((($s >= $start) && ($s <= $stop)) || |
| | 871 | (($e >= $start) && ($e <= $stop)) || |
| | 872 | (($s <= $start) && ($e >= $stop))); |
| | 873 | } |
| | 874 | } |
| | 875 | $stats{gaps_skipped}++; |
| | 876 | return 0; |
| | 877 | } |
| | 878 | |
| | 879 | ############################################################################## |
| | 880 | |