From e3a77a73ad803eda7e690b8ccdb43c95c2be734a Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Fri, 23 Dec 2011 21:13:56 +0000 Subject: [PATCH] Fix days_since_epoch to year_yday calculation --- util.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/util.c b/util.c index 01d29c10..1410c44c 100644 --- a/util.c +++ b/util.c @@ -256,7 +256,9 @@ 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, 366); + new_year = year + + (int) LDNS_DIV( days + , is_leap_year(year) ? 366 : 365 ); if (year == new_year) { year += days < 0 ? -1 : 1; } -- 2.47.3