Your message dated Sun, 06 Aug 2017 04:59:46 +0000
with message-id <e1dedfg-0004pa...@fasolo.debian.org>
and subject line Bug#870431: Removed package(s) from unstable
has caused the Debian Bug report #693704,
regarding libdatetime-astro-sunrise-perl: Fails if sunrise and set not in same 
day
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
693704: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=693704
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: libdatetime-astro-sunrise-perl
Version: 0.01.01-3
Severity: important

Dear Maintainer,

     If I use 

$sunrise = DateTime::Astro::Sunrise->new( $long, $lat, -0.583, 0);
($rise, $set) = $sunrise->sunrise($dt);

where lat/long are in Australia and date is about now (19th Nov 2012)
the method sunrise fails

 The 'minute' parameter ("-59") to DateTime::new did not pass the 'an integer 
between 0 and 59' callback
 at /usr/lib/perl5/DateTime.pm line 199
        DateTime::new(undef, 'year', 2012, 'month', 11, 'day', 19, 'hour', 20, 
...) called at /usr/share/perl5/DateTime/Astro/Sunrise.pm line 129

This is because sunrise is on the day before sunset in UTC and sunrise
uses negative numbers as arguments to datetime->new for hour and
minute.

The fix seems to be to use the math capability of DateTime to set the hour and 
minute:

       my $rise_time = DateTime->new(
            year      => $dt->year,
            month     => $dt->month,
            day       => $dt->day,
            hour      => 0,
            minute    => 0,
            time_zone => 'UTC')->add(hours=>$hour_rise,
                                     minutes => $min_rise);

in the 4 places where the times are initialized.

Patch attached but all I can say is 'it works for me'.  I've tested it in any 
generalised way.



-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-3-686-pae (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages libdatetime-astro-sunrise-perl depends on:
ii  libdatetime-perl  2:0.7500-1
ii  perl              5.14.2-13

libdatetime-astro-sunrise-perl recommends no packages.

libdatetime-astro-sunrise-perl suggests no packages.

-- no debconf information

-- debsums errors found:
debsums: changed file /usr/share/perl5/DateTime/Astro/Sunrise.pm (from 
libdatetime-astro-sunrise-perl package)

That's because I've modified it!
--- Sunrise.bak	2012-11-19 13:42:13.724006946 +0000
+++ Sunrise.pm	2012-11-19 14:21:30.536744605 +0000
@@ -40,7 +40,6 @@
     my ( $year, $month, $day ) = ( $dt->year, $dt->month, $dt->day );
     my $altit     = $self->{ALT} || -0.833;
     my $iteration = defined( $self->{ITER} ) ? $self->{ITER} : 0;
-
     if ($iteration) {
 
         # This is the initial start
@@ -102,22 +101,24 @@
 
         my ( $hour_rise, $min_rise, $hour_set, $min_set ) = convert_hour($tmp_rise_3,$tmp_set_3);
         my $rise_time = DateTime->new(
-          year      => $dt->year,
-          month     => $dt->month,
-          day       => $dt->day,
-          hour      => $hour_rise % 24,
-          minute    => $min_rise,
-          time_zone => 'UTC'
-        );
+	    year      => $dt->year,
+	    month     => $dt->month,
+	    day       => $dt->day,
+	    hour      => 0,
+	    minute    => 0,
+	    time_zone => 'UTC')->add(hours=>$hour_rise,
+				     minutes => $min_rise
+	    );
         my $set_time = DateTime->new(
-          year      => $dt->year,
-          month     => $dt->month,
-          day       => $dt->day,
-          hour      => $hour_set % 24,
-          minute    => $min_set,
-          time_zone => 'UTC'
-        );
-      return ($rise_time, $set_time); 
+	    year      => $dt->year,
+	    month     => $dt->month,
+	    day       => $dt->day,
+	    hour      => 0,
+	    minute    => 0,
+	    time_zone => 'UTC')->add(hours=>$hour_set,
+				     minutes => $min_set
+	    );
+	return ($rise_time, $set_time); 
     }
     else {
         my $d =
@@ -127,23 +128,24 @@
           sun_rise_set( $d, $self->{LON}, $self->{LAT}, $altit, 15.0 );
         my ( $hour_rise, $min_rise, $hour_set, $min_set ) =
           convert_hour( $h1, $h2 );
-
         my $rise_time = DateTime->new(
-          year      => $dt->year,
-          month     => $dt->month,
-          day       => $dt->day,
-          hour      => $hour_rise % 24,
-          minute    => $min_rise,
-          time_zone => 'UTC'
-        );
+	    year      => $dt->year,
+	    month     => $dt->month,
+	    day       => $dt->day,
+	    hour      => 0,
+	    minute    => 0,
+	    time_zone => 'UTC')->add(hours=>$hour_rise,
+				     minutes => $min_rise
+	    );
         my $set_time = DateTime->new(
-          year      => $dt->year,
-          month     => $dt->month,
-          day       => $dt->day,
-          hour      => $hour_set % 24,
-          minute    => $min_set,
-          time_zone => 'UTC'
-        );
+	    year      => $dt->year,
+	    month     => $dt->month,
+	    day       => $dt->day,
+	    hour      => 0,
+	    minute    => 0,
+	    time_zone => 'UTC')->add(hours=>$hour_set,
+				     minutes => $min_set
+	    );
       return ($rise_time, $set_time);
     }
 

--- End Message ---
--- Begin Message ---
Version: 0.01.01-3+rm

Dear submitter,

as the package libdatetime-astro-sunrise-perl has just been removed from the 
Debian archive
unstable we hereby close the associated bug reports.  We are sorry
that we couldn't deal with your issue properly.

For details on the removal, please see https://bugs.debian.org/870431

The version of this package that was in Debian prior to this removal
can still be found using http://snapshot.debian.org/.

This message was generated automatically; if you believe that there is
a problem with it please contact the archive administrators by mailing
ftpmas...@ftp-master.debian.org.

Debian distribution maintenance software
pp.
Scott Kitterman (the ftpmaster behind the curtain)

--- End Message ---

Reply via email to