From bbc684dcd6cfbc36a3ca835d175c487d7a8ee787 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Fri, 23 Dec 2011 23:13:37 +0000 Subject: [PATCH] A simpeler solution is possible.. --- util.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) 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; -- 2.47.3