Returns the last full interval before now.
If interval is 0 or smaller, the result is put to 0. This holds for time component individually.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_time_type), | intent(in) | :: | now | |||
type(tem_time_type), | intent(in) | :: | interval |
elemental function tem_time_last_interval(now, interval) result(last)
! -------------------------------------------------------------------- !
type(tem_time_type), intent(in) :: now
type(tem_time_type), intent(in) :: interval
type(tem_time_type) :: last
! -------------------------------------------------------------------- !
! -------------------------------------------------------------------- !
last%sim = 0.0_rk
last%iter = 0
last%clock = 0.0_rk
if (interval%sim > 0.0_rk) then
last%sim = floor(now%sim / interval%sim) * interval%sim
end if
if (interval%iter > 0) then
last%iter = (now%iter / interval%iter) * interval%iter
end if
if (interval%clock > 0.0_rk) then
last%clock = floor(now%clock / interval%clock) * interval%clock
end if
end function tem_time_last_interval