[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[UDUNITS #VZB-644403]: Bug in deprecated udunits 1.12.9



Hi Christian,

> I have found a bug in the deprecated udunits 1.12.9. I thought that you may
> be interested as this version is still used by many.
> 
> I used utCalendar and, in some occasions, I had minutes==60 in the returned
> values by the function, which caused my program to fail.

Interesting.  I would not have thought that possible.  Thanks for sending this 
in.

> Here is the fix:
> in src/lib/utlib.c:
> 
> Starting line #445
> 
> Before fix:
> if ((float)seconds >= 60) {
> seconds -= 60;
> if (++minutes >= 60) {
> minutes -= 60;
> if (++hours >= 24) {
> hours -= 24;
> days++;
> }
> }
> }
> 
> 
> After fix:
> if ((float)seconds >= 60) {
> seconds -= 60;
> if (++minutes >= 60) {
> minutes -= 60;
> if (++hours >= 24) {
> hours -= 24;
> days++;
> }
> }
> }
> else if (minutes >= 60) {
> minutes -= 60;
> if (++hours >= 24) {
> hours -= 24;
> days++;
> }
> }
> else if (hours >= 24) {
> hours -= 24;
> days++;
> }

I added a fix similar to this and made a new release.

Again, thanks!

> Regards,
> 
> Christian PagÃ


Regards,
Steve Emmerson

Ticket Details
===================
Ticket ID: VZB-644403
Department: Support UDUNITS
Priority: Normal
Status: Closed


NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.