Skip to content

Commit

Permalink
Only modify the mostRecentAccessTime is a stream was actually read
Browse files Browse the repository at this point in the history
Before this commit, a default value of '0000-01-01_00:00:00' was being
saved to the new mostRecentAccessTime attribute on calls to mpas_stream_mgr_read()
where a stream wasn't actually read because its alarm wasn't ringing.

This commit initializes actualWhen_local to a non-time value in order to
only set mostRecentAccessTime if actualWhen_local is successfully
updated to a time by read_stream().
  • Loading branch information
matthewhoffman committed Feb 3, 2022
1 parent d9bbcc4 commit acc4d50
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions components/mpas-framework/src/framework/mpas_stream_manager.F
Original file line number Diff line number Diff line change
Expand Up @@ -3474,7 +3474,7 @@ subroutine MPAS_stream_mgr_read(manager, streamID, timeLevel, mgLevel, rightNow,
STREAM_DEBUG_WRITE('-- Called MPAS_stream_mgr_read()')

if (present(ierr)) ierr = MPAS_STREAM_MGR_NOERR
write(actualWhen_local,'(a)') '0000-01-01_00:00:00'
write(actualWhen_local,'(a)') 'UNKNOWN'

!
! Use optional arguments or set defaults
Expand Down Expand Up @@ -3533,8 +3533,11 @@ subroutine MPAS_stream_mgr_read(manager, streamID, timeLevel, mgLevel, rightNow,
if (local_saveActualWhen) then
call read_stream(manager, stream_cursor, local_timeLevel, local_mgLevel, local_rightNow, local_when, &
local_whence, actualWhen_local, local_ierr)
call mpas_set_time(actualWhen_time, dateTimeString = actualWhen_local)
stream_cursor % mostRecentAccessTime = actualWhen_time
if (trim(actualWhen_local) /= 'UNKNOWN') then
! Only set mostRecentAccessTime if the stream was successfully read
call mpas_set_time(actualWhen_time, dateTimeString = actualWhen_local)
stream_cursor % mostRecentAccessTime = actualWhen_time
endif
else
call read_stream(manager, stream_cursor, local_timeLevel, local_mgLevel, local_rightNow, local_when, &
local_whence, ierr=local_ierr)
Expand Down Expand Up @@ -3563,8 +3566,11 @@ subroutine MPAS_stream_mgr_read(manager, streamID, timeLevel, mgLevel, rightNow,
if (local_saveActualWhen) then
call read_stream(manager, stream_cursor, local_timeLevel, local_mgLevel, local_rightNow, &
local_when, local_whence, actualWhen_local, temp_ierr)
call mpas_set_time(actualWhen_time, dateTimeString = actualWhen_local)
stream_cursor % mostRecentAccessTime = actualWhen_time
if (trim(actualWhen_local) /= 'UNKNOWN') then
! Only set mostRecentAccessTime if the stream was successfully read
call mpas_set_time(actualWhen_time, dateTimeString = actualWhen_local)
stream_cursor % mostRecentAccessTime = actualWhen_time
endif
else
call read_stream(manager, stream_cursor, local_timeLevel, local_mgLevel, local_rightNow, &
local_when, local_whence, ierr=temp_ierr)
Expand Down

0 comments on commit acc4d50

Please sign in to comment.