subroutine test_convert_CF_Time_to_datetime_duration() type(CF_Time_Integer) :: cfti type(CF_Time_Real) :: cftr integer :: iduration = 1800 real(R64) :: rduration = 1800.0 type(datetime_duration) :: dt_dur character(len=*), parameter :: time_unit = 'seconds' character(len=*), parameter :: base_datetime = '1999-12-31 23:29:59' character(len=*), parameter :: units = time_unit // ' since ' // base_datetime integer :: status call convert_CF_Time_to_datetime_duration(iduration, units, dt_dur, rc = status) call convert_CF_Time_to_datetime_duration(rduration, units, dt_dur, rc = status) @assertEqual(SUCCESS, status, 'Conversion unsuccessful') @assertEqual(rduration, dt_dur % second_real, 'Duration does not match.') cfti = CF_Time_Integer(iduration, units) @assertTrue(cfti % is_valid, 'Invalid CF_Time_Integer') call convert_CF_Time_to_datetime_duration(cfti, dt_dur, rc = status) @assertEqual(SUCCESS, status, 'Conversion unsuccessful') @assertEqual(iduration, dt_dur % second, 'Duration does not match.') cftr = CF_Time_Real(rduration, units) @assertTrue(cftr % is_valid, 'Invalid CF_Time_Real') call convert_CF_Time_to_datetime_duration(cftr, dt_dur, rc = status) @assertEqual(SUCCESS, status, 'Conversion unsuccessful') @assertEqual(rduration, dt_dur % second_real, 'Duration does not match.') end subroutine test_convert_CF_Time_to_datetime_duration