This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Hi Christian, [Sorry for taking so long to respond. I was on holiday.] > The code needs to be modified slightly to ensure that if conditions are met . > If not the double precision very small leftovers are interfering and > prevents the code to go into the if condition when needed. > > In unitcore.c, line 536, adding: > > if ((float)seconds >= 60.0) { > seconds = 0.0; > if ((float)++minutes >= 60) { > minutes = 0.0; > if ((float)++hours >= 24) { > hours = 0.0; > days++; > } > } > } > else if ((float)minutes >= 60) { > minutes = 0.0; > if ((float)++hours >= 24) { > hours = 0.0; > days++; > } > } > else if ((float)hours >= 24) { > hours = 0.0; > days++; > } I copied the improvements from the UDUNITS-1 to the UDUNITS-2 code and made a new release (2.1.24). Thanks for reporting this. > Christian Regards, Steve Emmerson Ticket Details =================== Ticket ID: VZB-644403 Department: Support UDUNITS Priority: Normal Status: Closed