Wrong seconds in Alt

Bug #616748 reported by anbar
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Stellarium
Fix Released
Low
Alexander Wolf

Bug Description

Stellarium 0.10.5 on Ubuntu 10.04 LTS
The Az/Alt increments seconds up to 60 instead of 59

Related branches

Revision history for this message
Matthew Gates (matthew-porpoisehead) wrote :

Where do you see this?

Changed in stellarium:
status: New → Incomplete
Revision history for this message
anbar (anbar09) wrote : Re: [Bug 616748] Re: Wrong seconds in Alt

When you click on an object, in left upper corner in the object's
details there's Az/El line

On 21/10/10 18:25, Matthew Gates wrote:
> Where do you see this?
>
> ** Changed in: stellarium
> Status: New => Incomplete
>

Revision history for this message
Matthew Gates (matthew-porpoisehead) wrote :

I suspect a "floor" is needed somewhere.

Changed in stellarium:
importance: Undecided → Low
status: Incomplete → Confirmed
Revision history for this message
Matthew Gates (matthew-porpoisehead) wrote :
Changed in stellarium:
milestone: none → 1.0.0
Revision history for this message
trashman (trashman) wrote :
Revision history for this message
Matthew Gates (matthew-porpoisehead) wrote :

I thought about doing it like this, but when the seconds is > 59.5
this method will display 59.0 seconds.... Rounding should be done to
closest, not always down. The problem with that is that you then need
to handle the carry to minutes and potentially hours/degrees. I
started to do this, but I didn't come up with an elegant enough way to
do it quite yet. I could commit an ugly fix, but I'd rather get it
pretty.

Revision history for this message
norbinz (norbinz) wrote :

My technique is to convert the floating-point angle into a sign flag and positive integer containing arcseconds. Then chop up the integer into degrees minutes seconds.

#include <stdio.h>
#include <math.h>

void dms(double degrees)
{
  int n, dd, mm, ss;
  char sign;

  sign = degrees < 0 ? '-' : '+';
  n = (int)floor(fabs(3600 * degrees) + 0.5);
  ss = n % 60; /* seconds digits */
  n /= 60;
  mm = n % 60; /* minutes digits */
  dd = n / 60; /* degrees digits */
  printf("%c%02dd %02dm %02ds\n", sign, dd, mm, ss);
}

int main(void)
{
  dms(+( 0 + 0.0/60 + 0.49/3600)); /* +00d 00m 00s */
  dms(+( 0 + 0.0/60 + 0.51/3600)); /* +00d 00m 01s */

  dms(-( 0 + 0.0/60 + 0.49/3600)); /* -00d 00m 00s */
  dms(-( 0 + 0.0/60 + 0.51/3600)); /* -00d 00m 01s */

  dms(+(89 + 59.0/60 + 59.49/3600)); /* +89d 59m 59s */
  dms(+(89 + 59.0/60 + 59.51/3600)); /* +90d 00m 00s */

  dms(-(89 + 59.0/60 + 59.49/3600)); /* -89d 59m 59s */
  dms(-(89 + 59.0/60 + 59.51/3600)); /* -90d 00m 00s */
  return 0;
}

Revision history for this message
anbar (anbar09) wrote :

How about this:
  if seconds < 60.0 then display
else
seconds = seconds - 60.0

On 07/12/10 13:34, Matthew Gates wrote:
> I thought about doing it like this, but when the seconds is> 59.5
> this method will display 59.0 seconds.... Rounding should be done to
> closest, not always down. The problem with that is that you then need
> to handle the carry to minutes and potentially hours/degrees. I
> started to do this, but I didn't come up with an elegant enough way to
> do it quite yet. I could commit an ugly fix, but I'd rather get it
> pretty.
>

Revision history for this message
anbar (anbar09) wrote :

How about this:
  if seconds < 60.0.then display
  else
  seconds = seconds - 60.0

On 07/12/10 13:34, Matthew Gates wrote:
> I thought about doing it like this, but when the seconds is> 59.5
> this method will display 59.0 seconds.... Rounding should be done to
> closest, not always down. The problem with that is that you then need
> to handle the carry to minutes and potentially hours/degrees. I
> started to do this, but I didn't come up with an elegant enough way to
> do it quite yet. I could commit an ugly fix, but I'd rather get it
> pretty.
>

Revision history for this message
Alexander Wolf (alexwolf) wrote :

> if seconds < 60.0 then display
> else
> seconds = seconds - 60.0

No, it's a bad idea because minutes not updated

Changed in stellarium:
assignee: nobody → Alexander Wolf (alexwolf)
status: Confirmed → In Progress
Changed in stellarium:
status: In Progress → Fix Committed
treaves (treaves)
Changed in stellarium:
milestone: 1.0.0 → 0.11.0
Changed in stellarium:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.