diff --git a/src/libmtime_hl.f90 b/src/libmtime_hl.f90 index 06d61391453609421062327e170c64264b478ac3..c8f758b3048af8d570f0f7b21a2a8bf2e077fd53 100644 --- a/src/libmtime_hl.f90 +++ b/src/libmtime_hl.f90 @@ -36,7 +36,8 @@ MODULE mtime_hl USE, INTRINSIC :: iso_c_binding, ONLY: c_int32_t, c_int64_t, c_double, & - & c_null_char, c_ptr, c_loc, c_f_pointer + & c_null_char, c_ptr, c_loc, c_f_pointer, & + & c_null_ptr USE mtime_c_bindings USE mtime_constants use mtime_error_handling diff --git a/src/mtime_t_event.inc b/src/mtime_t_event.inc index d9a99867d8ea7e25c89e1ede5e7e4637ba6d38b1..44c9c11e9ef0e40abb2ebbe4a1b964c195e1cffe 100644 --- a/src/mtime_t_event.inc +++ b/src/mtime_t_event.inc @@ -110,16 +110,30 @@ FUNCTION t_event_is_active(this, my_datetime, plus_slack, minus_slack) result(ret) - CLASS(t_event) :: this + CLASS(t_event), TARGET :: this TYPE(t_datetime) :: my_datetime TYPE(t_timedelta), OPTIONAL :: plus_slack TYPE(t_timedelta), OPTIONAL :: minus_slack + TYPE(t_event), POINTER :: tmp_ev + TYPE(c_ptr) :: tmp_dt, tmp_plus, tmp_minus logical(c_bool) :: ret - !FIXME - STOP - !ret = isCurrentEventActive(this, my_datetime%dt, plus_slack%td, minus_slack%td) - + tmp_ev => this + tmp_dt = my_datetime%get_c_pointer() + if (present(plus_slack)) then + tmp_plus = plus_slack%get_c_pointer() + else + tmp_plus = c_null_ptr + endif + + if (present(minus_slack)) then + tmp_minus = minus_slack%get_c_pointer() + else + tmp_minus = c_null_ptr + endif + + ret = my_isCurrentEventActive(c_loc(tmp_ev), tmp_dt, & + & tmp_plus, tmp_minus) END FUNCTION t_event_is_active ! ================================================================================