CronNextTime Function

public function CronNextTime(time, cron) result(next)

returns the next time to start a process given the current time

Arguments

Type IntentOptional Attributes Name
type(DateTime), intent(in) :: time

current time

type(CronTab), intent(in) :: cron

cron table

Return Value type(DateTime)


Variables

Type Visibility Attributes Name Initial
integer(kind=short), public :: dt = 60

second

logical, public :: isTime

Source Code

FUNCTION CronNextTime &
!
(time, cron)  &
!
RESULT (next)

IMPLICIT NONE

!Arguments with intent (in):
TYPE (DateTime), INTENT (IN) :: time  !!current time
TYPE (CronTab),  INTENT (IN) :: cron  !!cron table

!local declarationsnext
TYPE (DateTime) :: next
LOGICAL :: isTime
INTEGER (KIND = short) :: dt = 60 !! second

!-------------------------------------end of declarations----------------------

isTime = .FALSE.
next = time + dt
DO WHILE ( .NOT. isTime )
    isTime = CronIsTime (next, cron)
    next = next + dt
END DO

RETURN
END FUNCTION CronNextTime