dtimer_stop captures date_and_time immediately, converts the stop value
to UTC epoch seconds, validates that dtimer_start was called, optionally
averages and prints the duration, and writes the finalized value to
elapsed_dtime.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(timer), | intent(inout) | :: | this |
Timer instance previously started with |
||
| integer, | intent(in), | optional | :: | nloops |
Optional positive loop count used to compute average date/time duration. |
|
| character(len=*), | intent(in), | optional | :: | message |
Optional output label; defaults to |
|
| logical, | intent(in), | optional | :: |
Optional output switch; defaults to |
||
| character(len=*), | intent(in), | optional | :: | color |
Optional FACE foreground color used for printed output. |
|
| character(len=*), | intent(in), | optional | :: | rfmt |
Optional Fortran real edit descriptor used for printed output. |
subroutine dtimer_stop(this, nloops, message, print, color, rfmt) class(timer), intent(inout) :: this !! Timer instance previously started with `dtimer_start`. integer, intent(in), optional :: nloops !! Optional positive loop count used to compute average date/time duration. character(*), intent(in), optional :: message !! Optional output label; defaults to `Elapsed time:`. logical, intent(in), optional :: print !! Optional output switch; defaults to `.true.`. character(*), intent(in), optional :: color !! Optional FACE foreground color used for printed output. character(*), intent(in), optional :: rfmt !! Optional Fortran real edit descriptor used for printed output. integer :: v(8) !! Raw `date_and_time` values captured at stop. real(rk) :: t_end !! Stop time converted to UTC epoch seconds. real(rk) :: raw_seconds !! Raw elapsed date/time duration in seconds. real(rk) :: out_seconds !! Final date/time duration after validation and optional loop averaging. logical :: ok !! Finalization status returned by `finalize_timing`. call date_and_time(values=v) t_end = epoch_seconds_utc(v) if (.not. this%is_dtime_started) then write(error_unit, '(A)') 'Error: dtimer_stop called before dtimer_start!' return end if this%is_dtime_started = .false. raw_seconds = t_end - this%dtime_start_utc call finalize_timing(raw_seconds, nloops, out_seconds, 'Elapsed time:', message, print, color, rfmt, ok) if (.not. ok) return this%elapsed_dtime = out_seconds end subroutine dtimer_stop