diff options
author | Jean Forget <J2N-FORGET@orange.fr> | 2013-10-03 22:45:53 +0200 |
---|---|---|
committer | Jean Forget <J2N-FORGET@orange.fr> | 2013-10-03 22:45:53 +0200 |
commit | b7a68f3be36a45821911c08c97cf54ff95ce2bc5 (patch) | |
tree | 7ce4297b24679a14a1f4b9fb1b09c55aaa0a5ff7 /lib/DateTime/Event/Sunrise.pm | |
parent | 6a4307547a587337d39fa5741f32281819f9e118 (diff) |
Apply patch from RT ticket 36532. Thank you Michael.
Diffstat (limited to 'lib/DateTime/Event/Sunrise.pm')
-rw-r--r-- | lib/DateTime/Event/Sunrise.pm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/DateTime/Event/Sunrise.pm b/lib/DateTime/Event/Sunrise.pm index 86857a6..c33e54c 100644 --- a/lib/DateTime/Event/Sunrise.pm +++ b/lib/DateTime/Event/Sunrise.pm @@ -267,6 +267,9 @@ sub _following_sunrise { );
my $new_dt = $dt + $d;
( $tmp_rise, undef ) = _sunrise( $self, $new_dt );
+ return $tmp_rise if $tmp_rise > $dt;
+ $new_dt = $new_dt + $d;
+ ( $tmp_rise, undef ) = _sunrise( $self, $new_dt );
return $tmp_rise;
}
@@ -301,6 +304,9 @@ sub _previous_sunrise { );
my $new_dt = $dt - $d;
( $tmp_rise, undef ) = _sunrise( $self, $new_dt );
+ return $tmp_rise if $tmp_rise < $dt;
+ $new_dt = $new_dt - $d;
+ ( $tmp_rise, undef ) = _sunrise( $self, $new_dt );
return $tmp_rise;
}
@@ -335,6 +341,9 @@ sub _following_sunset { );
my $new_dt = $dt + $d;
( undef, $tmp_set ) = _sunrise( $self, $new_dt );
+ return $tmp_set if $tmp_set > $dt;
+ $new_dt = $new_dt + $d;
+ ( undef, $tmp_set ) = _sunrise( $self, $new_dt );
return $tmp_set;
}
@@ -369,6 +378,9 @@ sub _previous_sunset { );
my $new_dt = $dt - $d;
( undef, $tmp_set ) = _sunrise( $self, $new_dt );
+ return $tmp_set if $tmp_set < $dt;
+ $new_dt = $new_dt - $d;
+ ( undef, $tmp_set ) = _sunrise( $self, $new_dt );
return $tmp_set;
}
|