Skip to content
Snippets Groups Projects

Make mtime omni-parsable

Closed Remo Dietlicher requested to merge omni-fix into master
3 files
+ 120
41
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 39
14
@@ -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)
@@ -217,7 +233,8 @@
INTEGER(c_int) :: t_datetime_daysInEntireMonth
t_datetime_daysInEntireMonth = my_getnoofdaysinmonthdatetime(c_loc(this%dt))
call handle_errno(t_datetime_daysInEntireMonth == 0, 4 * 100 + 15, &
& __FILE__, __LINE__)
__FILE__, &
__LINE__)
END FUNCTION t_datetime_daysInEntireMonth
FUNCTION t_datetime_daysInEntireYear(this)
@@ -225,7 +242,8 @@
INTEGER(c_int) :: t_datetime_daysInEntireYear
t_datetime_daysInEntireYear = my_getnoofdaysinyeardatetime(c_loc(this%dt))
CALL handle_errno(t_datetime_daysInEntireYear == 0, 4 * 100 + 16, &
& __FILE__, __LINE__)
__FILE__, &
__LINE__)
END FUNCTION t_datetime_daysInEntireYear
FUNCTION t_datetime_elapsedDaysInYear(this)
@@ -234,7 +252,8 @@
t_datetime_elapsedDaysInYear = my_getdayofyearfromdatetime(c_loc(this%dt))
CALL handle_errno(t_datetime_elapsedDaysInYear == 0, 4 * 100 + 17, &
& __FILE__, __LINE__)
__FILE__, &
__LINE__)
END FUNCTION t_datetime_elapsedDaysInYear
FUNCTION t_datetime_elapsedSecondsInMonth(this)
@@ -242,7 +261,9 @@
INTEGER(c_int64_t) :: t_datetime_elapsedSecondsInMonth
t_datetime_elapsedSecondsInMonth = my_getnoofsecondselapsedinmonthdatetime(c_loc(this%dt))
CALL handle_errno(t_datetime_elapsedSecondsInMonth == -1, 4 * 100 + 18, &
& __FILE__, __LINE__)
& &
__FILE__, &
__LINE__)
END FUNCTION t_datetime_elapsedSecondsInMonth
FUNCTION t_datetime_elapsedSecondsInDay(this)
@@ -251,7 +272,9 @@
t_datetime_elapsedSecondsInDay = my_getnoofsecondselapsedindaydatetime(c_loc(this%dt))
CALL handle_errno(t_datetime_elapsedSecondsInDay == -1, 4 * 100 + 19, &
& __FILE__, __LINE__)
& &
__FILE__, &
__LINE__)
END FUNCTION t_datetime_elapsedSecondsInDay
@@ -261,7 +284,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
Loading