Skip to content
Snippets Groups Projects
Commit 96ac7ffc authored by Karl-Hermann Wieners's avatar Karl-Hermann Wieners
Browse files

Merge remote-tracking branch 'origin/1.0.10-python-2to3-dt_dt_td_division-mtime' into master

parents d55b38d3 018d3efd
No related branches found
No related tags found
No related merge requests found
......@@ -11,7 +11,9 @@
TYPE(datetime), POINTER :: dt_tmp
INTEGER :: errno
c_pointer = my_newdatetime(TRIM(ADJUSTL(dt_string))//c_null_char)
CALL handle_errno(.NOT. c_ASSOCIATED(c_pointer), 4 *100 + 1, __FILE__, __LINE__)
CALL handle_errno(.NOT. c_ASSOCIATED(c_pointer), 4 *100 + 1, &
& __FILE__, &
& __LINE__)
CALL c_f_pointer(c_pointer, dt_tmp)
t_datetime_assign_string%dt = dt_tmp
CALL my_deallocatedatetime(c_pointer)
......@@ -29,7 +31,9 @@
TYPE(c_ptr) :: c_pointer
c_pointer = my_newrawdatetime(year, month, day, hour, minute, second, ms)
CALL handle_errno(.NOT. c_ASSOCIATED(c_pointer), 4 *100 + 2, __FILE__, __LINE__)
CALL handle_errno(.NOT. c_ASSOCIATED(c_pointer), 4 *100 + 2, &
& __FILE__, &
& __LINE__)
call c_f_pointer(c_pointer, dt_tmp)
res%dt = dt_tmp
CALL my_deallocatedatetime(c_pointer)
......@@ -55,9 +59,13 @@
string = ""
c_pointer = this%get_c_pointer()
CALL handle_errno(.not. c_associated(c_pointer), 0 * 100 + 2, __FILE__, __LINE__)
CALL handle_errno(.not. c_associated(c_pointer), 0 * 100 + 2, &
& __FILE__, &
& __LINE__)
dummy_ptr = my_datetimetostring(c_pointer, string)
CALL handle_errno(.not. c_associated(dummy_ptr), 4 * 100 + 6, __FILE__, __LINE__)
CALL handle_errno(.not. c_associated(dummy_ptr), 4 * 100 + 6, &
& __FILE__, &
& __LINE__)
char_loop: do i = 1 , len(string)
if (string(i:i) == c_null_char) exit char_loop
......@@ -79,7 +87,9 @@
string = ""
c_pointer = this%get_c_pointer()
dummy_ptr = my_datetoposixstring(c_pointer, string, format_string)
CALL handle_errno(.not. c_associated(dummy_ptr), 2 * 100 + 8, __FILE__, __LINE__)
CALL handle_errno(.not. c_associated(dummy_ptr), 2 * 100 + 8, &
& __FILE__, &
& __LINE__)
char_loop: do i = 1 , len(string)
if (string(i:i) == c_null_char) exit char_loop
end do char_loop
......@@ -94,7 +104,9 @@
type(c_ptr) :: c_pointer, dummy_ptr
c_pointer = this%get_c_pointer()
dummy_ptr = my_getjuliandayfromdatetime(c_pointer, c_loc(jd%jd))
CALL handle_errno(.not. c_associated(dummy_ptr), 0 * 100 + 2, __FILE__, __LINE__)
CALL handle_errno(.not. c_associated(dummy_ptr), 0 * 100 + 2, &
& __FILE__, &
& __LINE__)
CALL my_deallocatedatetime(c_pointer)
END FUNCTION t_datetime_toJulianDay
......@@ -111,7 +123,9 @@
c_pointer2 = td%get_c_pointer()
dummy_ptr = my_addtimedeltatodatetime(c_pointer1, c_pointer2, c_pointer1)
CALL handle_errno(.not. c_associated(dummy_ptr), 0 * 100 + 2, __FILE__, __LINE__)
CALL handle_errno(.not. c_associated(dummy_ptr), 0 * 100 + 2, &
& __FILE__, &
& __LINE__)
call c_f_pointer(c_pointer1, dt_tmp)
dt_td_sum%dt = dt_tmp
CALL my_deallocatedatetime(c_pointer1)
......@@ -139,7 +153,9 @@
c_pointer2 = td_tmp%get_c_pointer()
dummy_ptr = my_addtimedeltatodatetime(c_pointer1, c_pointer2, c_pointer1)
CALL handle_errno(.not. c_associated(dummy_ptr), 0 * 100 + 2, __FILE__, __LINE__)
CALL handle_errno(.not. c_associated(dummy_ptr), 0 * 100 + 2, &
& __FILE__, &
& __LINE__)
call c_f_pointer(c_pointer1, dt_tmp)
dt_td_sum%dt = dt_tmp
CALL my_deallocatedatetime(c_pointer1)
......@@ -261,7 +277,9 @@
c_pointer = my_newrawdatetime(int(this%dt%date%year,c_int64_t), this%dt%date%month, &
& this%dt%date%day, this%dt%time%hour, this%dt%time%minute, &
& this%dt%time%second, this%dt%time%ms)
call handle_errno((.not. c_associated(c_pointer)), 4 * 100 + 3, __FILE__, __LINE__)
call handle_errno((.not. c_associated(c_pointer)), 4 * 100 + 3, &
& __FILE__, &
& __LINE__)
END FUNCTION t_datetime_get_c_pointer
......@@ -13,7 +13,9 @@
c_pointer = my_newtimedeltafromstring(trim(adjustl(td_string))//c_null_char)
if (.not. c_associated(c_pointer)) then
call handle_errno(5 * 100 + 1, __FILE__, __LINE__)
call handle_errno(5 * 100 + 1, &
& __FILE__, &
& __LINE__)
t_timedelta_assign_string%td%sign = '?'
else
call c_f_pointer(c_pointer, td_tmp)
......@@ -31,9 +33,13 @@
CHARACTER(len=max_timedelta_str_len) :: td_string
INTEGER :: errno
CALL getptstringfromms(INT(td_ms,c_int64_t), td_string, errno)
CALL handle_errno(errno, __FILE__, __LINE__)
CALL handle_errno(errno, &
& __FILE__, &
& __LINE__)
td_tmp => newtimedelta(td_string, errno)
CALL handle_errno(errno, __FILE__, __LINE__)
CALL handle_errno(errno, &
& __FILE__, &
& __LINE__)
t_timedelta_assign_ms%td = td_tmp
t_timedelta_assign_ms%td%sign = td_tmp%sign
CALL deallocatetimedelta(td_tmp)
......@@ -47,9 +53,13 @@
CHARACTER(len=max_timedelta_str_len) :: td_string
INTEGER :: errno
CALL getptstringfromms(INT(td_ms,c_int64_t), td_string, errno)
CALL handle_errno(errno, __FILE__, __LINE__)
CALL handle_errno(errno, &
& __FILE__, &
& __LINE__)
td_tmp => newtimedelta(td_string, errno)
CALL handle_errno(errno, __FILE__, __LINE__)
CALL handle_errno(errno, &
& __FILE__, &
& __LINE__)
t_timedelta_assign_ms_i8%td = td_tmp
t_timedelta_assign_ms_i8%td%sign = td_tmp%sign
CALL deallocatetimedelta(td_tmp)
......@@ -114,11 +124,15 @@
TYPE(timedelta), POINTER :: td_tmp, td_tmp2
INTEGER :: errno
td_tmp => newtimedelta(this%td, errno)
CALL handle_errno(errno, __FILE__, __LINE__)
CALL handle_errno(errno, &
& __FILE__, &
& __LINE__)
NULLIFY(td_tmp2)
td_tmp2 = td_tmp * lambda
IF (ASSOCIATED(td_tmp2)) THEN
CALL handle_errno(general_arithmetic_error, __FILE__, __LINE__)
CALL handle_errno(general_arithmetic_error, &
& __FILE__, &
& __LINE__)
RETURN
END IF
scaled_td%td = td_tmp2
......@@ -134,11 +148,15 @@
TYPE(timedelta), POINTER :: td_tmp, td_tmp2
INTEGER :: errno
td_tmp => newtimedelta(this%td, errno)
CALL handle_errno(errno, __FILE__, __LINE__)
CALL handle_errno(errno, &
& __FILE__, &
& __LINE__)
NULLIFY(td_tmp2)
td_tmp2 = td_tmp * lambda
IF (ASSOCIATED(td_tmp2)) THEN
CALL handle_errno(general_arithmetic_error, __FILE__, __LINE__)
CALL handle_errno(general_arithmetic_error, &
& __FILE__, &
& __LINE__)
RETURN
END IF
scaled_td%td = td_tmp2
......@@ -156,7 +174,9 @@
dummy_ptr = my_elementwisescalarmultiplytimedelta(c_loc(this%td), int(lambda, c_int64_t), c_loc(scaled_td%td))
IF (.NOT. c_associated(dummy_ptr)) THEN
CALL handle_errno(0*100+2, __FILE__, __LINE__)
CALL handle_errno(0*100+2, &
& __FILE__, &
& __LINE__)
scaled_td%td%sign = '!'
ENDIF
......@@ -178,7 +198,9 @@
dummy_ptr = my_elementwisescalarmultiplytimedeltadp(c_loc(this%td), lambda, c_loc(scaled_td%td))
IF (.NOT. c_associated(dummy_ptr)) THEN
CALL handle_errno(0*100+2, __FILE__, __LINE__)
CALL handle_errno(0*100+2, &
& __FILE__, &
& __LINE__)
scaled_td%td%sign = '!'
ENDIF
......@@ -203,9 +225,13 @@
string = ""
c_pointer = this%get_c_pointer()
CALL handle_errno(.not. c_associated(c_pointer), 0 * 100 + 2, __FILE__, __LINE__)
CALL handle_errno(.not. c_associated(c_pointer), 0 * 100 + 2, &
& __FILE__, &
& __LINE__)
dummy_ptr = my_timedeltatostring(c_pointer, string)
CALL handle_errno(.not. c_associated(dummy_ptr), 4 * 100 + 6, __FILE__, __LINE__)
CALL handle_errno(.not. c_associated(dummy_ptr), 4 * 100 + 6, &
& __FILE__, &
& __LINE__)
char_loop: do i = 1 , len(string)
if (string(i:i) == c_null_char) exit char_loop
......@@ -227,26 +253,38 @@
INTEGER :: errno
tmp_dividend => newtimedelta(this%td, errno)
CALL handle_errno(errno, __FILE__, __LINE__)
CALL handle_errno(errno, &
& __FILE__, &
& __LINE__)
tmp_divisor => newtimedelta(divisor%td, errno)
CALL handle_errno(errno, __FILE__, __LINE__)
CALL handle_errno(errno, &
& __FILE__, &
& __LINE__)
IF (PRESENT(referenceDateTime)) THEN
tmp_ref => newDateTime(referenceDateTime%dt, errno)
CALL handle_errno(errno, __FILE__, __LINE__)
CALL handle_errno(errno, &
& __FILE__, &
& __LINE__)
ENDIF
CALL divideTimeDeltaInSeconds(tmp_dividend, tmp_divisor, quotient, errno)
IF (errno /= no_error) THEN
IF (.NOT. PRESENT(referenceDateTime)) THEN
CALL handle_errno(errno, __FILE__, __LINE__)
CALL handle_errno(errno, &
& __FILE__, &
& __LINE__)
ELSE
dt_tmp = referenceDateTime + this
tmp_dt => newDateTime(dt_tmp%dt, errno)
CALL handle_errno(errno, __FILE__, __LINE__)
CALL handle_errno(errno, &
& __FILE__, &
& __LINE__)
CALL divideDatetimeDifferenceInSeconds(tmp_dt, tmp_ref, &
& tmp_divisor, quotient, errno)
CALL handle_errno(errno, __FILE__, __LINE__)
CALL handle_errno(errno, &
& __FILE__, &
& __LINE__)
CALL deallocateDatetime(tmp_dt)
ENDIF
......@@ -284,11 +322,17 @@
TYPE(juliandelta), POINTER :: jd_tmp
INTEGER :: errno
td_tmp => newtimedelta(this%td, errno)
CALL handle_errno(errno, __FILE__, __LINE__)
CALL handle_errno(errno, &
& __FILE__, &
& __LINE__)
dt_tmp => newDatetime(dt%dt, errno)
CALL handle_errno(errno, __FILE__, __LINE__)
CALL handle_errno(errno, &
& __FILE__, &
& __LINE__)
jd_tmp => newJuliandelta('+', 0_c_int64_T, 0_c_int64_T, errno)
CALL handle_errno(errno, __FILE__, __LINE__)
CALL handle_errno(errno, &
& __FILE__, &
& __LINE__)
CALL timeDeltaToJulianDelta(td_tmp,dt_tmp,jd_tmp)
jd%jd = jd_tmp
......@@ -318,12 +362,18 @@
TYPE(datetime), POINTER :: dt_tmp
jd_tmp => newJulianDay(this%jd%day, this%jd%ms, errno)
CALL handle_errno(errno, __FILE__, __LINE__)
CALL handle_errno(errno, &
& __FILE__, &
& __LINE__)
dt_tmp => newDatetime("1970-01-01T00:00:00", errno)
CALL handle_errno(errno, __FILE__, __LINE__)
CALL handle_errno(errno, &
& __FILE__, &
& __LINE__)
CALL getDatetimeFromJulianDay(jd_tmp, dt_tmp, errno)
CALL handle_errno(errno, __FILE__, __LINE__)
CALL handle_errno(errno, &
& __FILE__, &
& __LINE__)
res%dt = dt_tmp
CALL deallocateJulianDay(jd_tmp)
......@@ -360,5 +410,7 @@
c_sign = this%td%sign(1:1)
c_pointer = my_newrawtimedelta(c_sign, int(this%td%year,c_int64_t), this%td%month, this%td%day, &
& this%td%hour, this%td%minute, this%td%second, this%td%ms)
call handle_errno((.not. c_associated(c_pointer)), 5 * 100 + 2, __FILE__, __LINE__)
call handle_errno((.not. c_associated(c_pointer)), 5 * 100 + 2, &
& __FILE__, &
& __LINE__)
END FUNCTION t_timedelta_get_c_pointer
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment