timer_start resets the pause state, caches system_clock metadata when
needed, validates that the clock rate can be converted to seconds, and then
captures the start tick. The matching stop routine is timer_stop.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(timer), | intent(inout) | :: | this |
Timer instance whose wall-clock state is initialized. |
subroutine timer_start(this) class(timer), intent(inout) :: this !! Timer instance whose wall-clock state is initialized. this%is_started = .true. this%is_paused = .false. this%paused_ticks = 0_ik if (this%clock_rate <= 0_ik .or. this%clock_max <= 0_ik) then call system_clock(count_rate=this%clock_rate, count_max=this%clock_max) end if if (this%clock_rate <= 0_ik) then write(error_unit, '(A)') 'Error: system_clock count_rate <= 0; timer unavailable on this platform.' this%is_started = .false. return end if call system_clock(count=this%clock_start) end subroutine timer_start