[ldns-users] Bug in ldns_year_and_yday_from_days_since_epoch (only on 32 bits)

Miek Gieben miek at miek.nl
Fri Dec 23 23:29:00 UTC 2011


[ Quoting <Willem at NLnetLabs.nl> at 00:17 on Dec 24 in "Re: [ldns-users] Bug..." ]
> Index: util.c
> ===================================================================
> --- util.c	(revision 3625)
> +++ util.c	(working copy)
> @@ -256,10 +256,7 @@
>  	int new_year;
>  
>  	while (days < 0 || days >= (int64_t) (is_leap_year(year) ? 366 : 365)) {
> -		new_year = year + (int) LDNS_DIV(days, 366);
> -		if (year == new_year) {
> -			year += days < 0 ? -1 : 1;
> -		}
> +		new_year = year + (int) LDNS_DIV(days, 365);
>  		days -= (new_year - year) * 365;
>  		days -= leap_days(year, new_year);
>  		year  = new_year;

Looks OK. I can ask Tom to apply it locally and test it a little?
(don't know if he's also on this list)

grtz Miek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.nlnetlabs.nl/pipermail/ldns-users/attachments/20111224/7fa175f1/attachment.bin>


More information about the ldns-users mailing list