From c94866b2cbb2925cdf77d329812d446f1acc62a0 Mon Sep 17 00:00:00 2001
From: Florian Prill <florian.prill@dwd.de>
Date: Mon, 13 May 2019 16:24:38 +0200
Subject: [PATCH] fixed return code handling.

---
 src/mtime_timedelta.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mtime_timedelta.c b/src/mtime_timedelta.c
index e709d556..98d24363 100644
--- a/src/mtime_timedelta.c
+++ b/src/mtime_timedelta.c
@@ -1213,7 +1213,7 @@ divideTimeDelta(struct _timedelta* dividend, struct _timedelta* divisor,
   quo_ret->quotient        = (int64_t) 0;
   quo_ret->remainder_days  = (int64_t) 0;
   quo_ret->remainder_in_ms = (int64_t) 0;
-  if (ret != 0) {
+  if (ret == 0) {
     quo_ret->quotient        = (int64_t) q_decimal;
     quo_ret->remainder_days  = (int64_t) remainder_days;
     quo_ret->remainder_in_ms = (int64_t) remainder_ms;
@@ -1231,7 +1231,7 @@ divideTimeDelta(struct _timedelta* dividend, struct _timedelta* divisor,
   deallocateJulianDelta(jd_dividend);
   deallocateJulianDelta(jd_divisor);
 
-  if (ret == 0)  return NULL;
+  if (ret != 0)  return NULL;
 
   return (quo_ret);
 }
-- 
GitLab