diff options
Diffstat (limited to 'fortran/src/H5_ff.F90')
-rw-r--r-- | fortran/src/H5_ff.F90 | 73 |
1 files changed, 68 insertions, 5 deletions
diff --git a/fortran/src/H5_ff.F90 b/fortran/src/H5_ff.F90 index f63e734..a66ac95 100644 --- a/fortran/src/H5_ff.F90 +++ b/fortran/src/H5_ff.F90 @@ -98,8 +98,8 @@ MODULE H5LIB ! ! H5O flags declaration ! - INTEGER, PARAMETER :: H5O_FLAGS_LEN = 27 - INTEGER, DIMENSION(1:H5O_FLAGS_LEN) :: H5o_flags + INTEGER, PARAMETER :: H5O_FLAGS_LEN = 33 + INTEGER, DIMENSION(1:H5O_FLAGS_LEN) :: H5O_flags ! ! H5P flags declaration ! @@ -139,8 +139,8 @@ MODULE H5LIB ! INTEGER, PARAMETER :: H5LIB_FLAGS_LEN = 2 INTEGER, DIMENSION(1:H5LIB_FLAGS_LEN) :: H5LIB_flags - - PUBLIC :: h5open_f, h5close_f, h5get_libversion_f, h5dont_atexit_f, h5kind_to_type, h5offsetof + + PUBLIC :: h5open_f, h5close_f, h5get_libversion_f, h5dont_atexit_f, h5kind_to_type, h5offsetof, h5gmtime PUBLIC :: h5garbage_collect_f, h5check_version_f CONTAINS @@ -488,7 +488,13 @@ CONTAINS H5O_TYPE_GROUP_F = h5o_flags(24) H5O_TYPE_DATASET_F = h5o_flags(25) H5O_TYPE_NAMED_DATATYPE_F = h5o_flags(26) - H5O_TYPE_NTYPES_F = h5o_flags(27) + H5O_TYPE_NTYPES_F = h5o_flags(27) + H5O_INFO_ALL_F = h5o_flags(28) + H5O_INFO_BASIC_F = h5o_flags(29) + H5O_INFO_TIME_F = h5o_flags(30) + H5O_INFO_NUM_ATTRS_F = h5o_flags(31) + H5O_INFO_HDR_F = h5o_flags(32) + H5O_INFO_META_SIZE_F = h5o_flags(33) ! ! H5P flags ! @@ -898,4 +904,61 @@ CONTAINS END FUNCTION h5offsetof +!****f* H5LIB_PROVISIONAL/h5gmtime +! +! NAME +! h5gmtime +! +! PURPOSE +! Convert time_t structure (C) to Fortran DATE AND TIME storage format. +! +! Inputs: +! stdtime_t - Object of type time_t that contains a time value +! +! Outputs: +! datetime - A date/time array using Fortran conventions: +! datetime(1) = year +! datetime(2) = month +! datetime(3) = day +! datetime(4) = 0 ! time is expressed as UTC (or GMT timezone) */ +! datetime(5) = hour +! datetime(6) = minute +! datetime(7) = second +! datetime(8) = millisecond -- not available, assigned - HUGE(0) +! +! AUTHOR +! M. Scot Breitenfeld +! January, 2019 +! +! Fortran Interface: + FUNCTION h5gmtime(stdtime_t) + IMPLICIT NONE + INTEGER(KIND=TIME_T), INTENT(IN) :: stdtime_t + INTEGER, DIMENSION(1:8) :: h5gmtime +!***** + TYPE(C_PTR) :: cptr + INTEGER(C_INT), DIMENSION(:), POINTER :: c_time + + INTERFACE + TYPE(C_PTR) FUNCTION gmtime(stdtime_t) BIND(C, NAME='gmtime') + IMPORT :: TIME_T, C_PTR + IMPLICIT NONE + INTEGER(KIND=TIME_T) :: stdtime_t + END FUNCTION gmtime + END INTERFACE + + cptr = gmtime(stdtime_t) + CALL C_F_POINTER(cptr, c_time, [9]) + + h5gmtime(1) = INT(c_time(6)+1900) ! year starts at 1900 + h5gmtime(2) = INT(c_time(5)+1) ! month starts at 0 in C + h5gmtime(3) = INT(c_time(4)) ! day + h5gmtime(4) = 0 ! time is expressed as UTC (or GMT timezone) + h5gmtime(5) = INT(c_time(3)) ! hour + h5gmtime(6) = INT(c_time(2)) ! minute + h5gmtime(7) = INT(c_time(1)) ! second + h5gmtime(8) = -32767 ! millisecond is not available, assign it -HUGE(0) + + END FUNCTION h5gmtime + END MODULE H5LIB |