Idiom #45 Pause execution for 5 seconds
Sleep for 5 seconds in current thread, before proceeding with the next instructions.
module M_time
contains
subroutine system_sleep(wait)
use,intrinsic :: iso_c_binding, only: c_int
integer,intent(in) :: wait
integer(kind=c_int):: waited
interface
function c_usleep(msecs) bind (C,name="usleep")
import
integer(c_int) :: c_usleep
integer(c_int),intent(in),VALUE :: msecs
end function c_usleep
end interface
if(wait.gt.0)then
waited=c_usleep(int(wait,kind=c_int))
endif
end subroutine system_sleep
end module M_time
program x
use M_time
call system_sleep(5000000)
end