From: Willem Toorop Date: Fri, 23 Dec 2011 23:13:37 +0000 (+0000) Subject: A simpeler solution is possible.. X-Git-Tag: release-1.6.12~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bbc684dcd6cfbc36a3ca835d175c487d7a8ee787;p=thirdparty%2Fldns.git A simpeler solution is possible.. --- diff --git a/util.c b/util.c index 1410c44c..f49a30d1 100644 --- a/util.c +++ b/util.c @@ -256,12 +256,7 @@ ldns_year_and_yday_from_days_since_epoch(int64_t days, struct tm *result) int new_year; while (days < 0 || days >= (int64_t) (is_leap_year(year) ? 366 : 365)) { - new_year = year - + (int) LDNS_DIV( days - , is_leap_year(year) ? 366 : 365 ); - 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;