From 0964baab865abecb30952054e885f662a596f427 Mon Sep 17 00:00:00 2001
From: Florian Prill <florian.prill@dwd.de>
Date: Mon, 13 May 2019 16:25:48 +0200
Subject: [PATCH] replaced div routine in hl interface.

---
 src/libmtime_hl.f90       |  2 +-
 src/mtime_t_timedelta.inc | 18 +++++-------------
 2 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/src/libmtime_hl.f90 b/src/libmtime_hl.f90
index c8f758b3..932bbe7a 100644
--- a/src/libmtime_hl.f90
+++ b/src/libmtime_hl.f90
@@ -194,7 +194,7 @@ MODULE mtime_hl
     ! thrown.
     PROCEDURE :: toMilliSeconds            => t_timedelta_toMilliSeconds
 
-    PROCEDURE :: divideInSecondsBy         => t_timedelta_divideInSecondsBy
+    PROCEDURE :: divideBy                  => t_timedelta_divideBy
 
 
     ! --- overloaded operators
diff --git a/src/mtime_t_timedelta.inc b/src/mtime_t_timedelta.inc
index 139d1476..83c6ef86 100644
--- a/src/mtime_t_timedelta.inc
+++ b/src/mtime_t_timedelta.inc
@@ -217,7 +217,7 @@
     CALL my_deallocatetimedelta(c_pointer) !deallocate timedelta
   END FUNCTION t_timedelta_toString
 
-  FUNCTION t_timedelta_divideInSecondsBy (this, divisor, referenceDateTime) RESULT(quotient)
+  FUNCTION t_timedelta_divideBy (this, divisor, referenceDateTime) RESULT(quotient)
     CLASS(t_timedelta), INTENT(in), target  :: this
     TYPE(t_timedelta),  INTENT(in), target  :: divisor
     TYPE(t_datetime),   INTENT(IN), target  :: referenceDateTime
@@ -225,20 +225,12 @@
     TYPE(t_datetime), target                :: dt_tmp
     type(c_ptr)                             :: dummy_ptr
 
-    dummy_ptr = my_divideTimeDeltaInSeconds(c_loc(this%td), c_loc(divisor%td), &
+    dummy_ptr = my_divideTimeDelta(c_loc(this%td), c_loc(divisor%td), &
                       & c_loc(referenceDateTime%dt), c_loc(quotient))
 
-    IF (.NOT. c_associated(dummy_ptr)) THEN
-        dt_tmp = referenceDateTime + this
-        dummy_ptr = my_dividedatetimedifferenceinseconds(c_loc(dt_tmp%dt),    &
-          &                     c_loc(referenceDateTime%dt), &
-          &                     c_loc(divisor%td), c_loc(quotient))
-
-        CALL handle_errno(.not. c_associated(dummy_ptr), general_arithmetic_error, &
-          __FILE__, &
-          __LINE__)
-    END IF
-  END FUNCTION t_timedelta_divideInSecondsBy
+    CALL handle_errno(.not. c_associated(dummy_ptr), general_arithmetic_error, &
+                      __FILE__, __LINE__)
+  END FUNCTION t_timedelta_divideBy
 
   FUNCTION t_timedelta_toSeconds (this, td) RESULT(seconds)
     CLASS(t_timedelta), INTENT(in) :: this
-- 
GitLab