subroutine get_file_times(filename,itime,alltimes,tseries,timeInterval,tint,tsteps,rc)
character(len=*), intent(in) :: filename
integer, intent(in) :: itime(2)
logical, intent(in) :: alltimes
type(ESMF_Time), allocatable, intent(inout) :: tseries(:)
type(ESMF_TimeInterval), intent(inout) :: timeInterval
integer, intent(out) :: tint
integer, intent(out) :: tsteps
integer, intent(out), optional :: rc
integer :: status
integer :: second,minute,hour,day,month,year
type(NetCDF4_fileFormatter) :: formatter
type(FileMetadata) :: basic_metadata
type(FileMetadataUtils) :: metadata
call formatter%open(trim(filename),pFIO_Read,_RC)
basic_metadata=formatter%read(_RC)
call metadata%create(basic_metadata,trim(filename))
call formatter%close(_RC)
tsteps = metadata%get_dimension('time',_RC)
call metadata%get_time_info(timeVector=tSeries,_RC)
if (.not.allTimes) then
tSteps=1
call UnpackDateTIme(itime,year,month,day,hour,minute,second)
deallocate(tSeries)
allocate(tSeries(1))
call ESMF_TimeSet(tSeries(1), yy=year, mm=month, dd=day, h=hour, m=minute, s=second,_RC)
end if
if (tSteps == 1) then
call ESMF_TimeIntervalSet( TimeInterval, h=6, m=0, s=0, _RC )
else
TimeInterval=tSeries(2)-tSeries(1)
end if
call ESMF_TimeIntervalGet(TimeInterval,h=hour,m=minute,s=second,_RC)
tint=hour*10000+minute*100+second
_RETURN(_SUCCESS)
end subroutine get_file_times