]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
A simpeler solution is possible..
authorWillem Toorop <willem@NLnetLabs.nl>
Fri, 23 Dec 2011 23:13:37 +0000 (23:13 +0000)
committerWillem Toorop <willem@NLnetLabs.nl>
Fri, 23 Dec 2011 23:13:37 +0000 (23:13 +0000)
util.c

diff --git a/util.c b/util.c
index 1410c44c0949a331bf17869cca30b4659e5a1282..f49a30d1e2853219cd1c8760853c966fd3d315cb 100644 (file)
--- 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;