system_sleep(3f) - [M_system:C_INTERFACE] call C sleep(3c) or usleep(3c) procedure (LICENSE:PD)
Synopsis
Description
Options
Examples
Author
License
subroutine system_sleep(wait_seconds)
type(TYPE),intent(in) :: wait_secondswhere TYPE may be INTEGER, REAL, or DOUBLEPRECISION
The system_sleep(3f) routine uses the intrinsic ISO_C_BINDING interface to call the C sleep(3c) procedure or usleep(3c) routine.
wait_seconds integer,real or doubleprecision number of seconds for process to sleep.
Sample program:
program demo_system_sleep use M_system, only : system_sleep, epoch_to_calendar implicit none integer :: i ! write(*,(2a))"Time before integer call is: ",epoch_to_calendar() call system_sleep(4) write(*,(2a))"Time after integer call is: ",epoch_to_calendar() write(*,*) write(*,(2a))"Time before real call is: ",epoch_to_calendar() call system_sleep(4.0) write(*,(2a))"Time after real call is: ",epoch_to_calendar() write(*,*) write(*,(2a))"Time before loop is: ",epoch_to_calendar() do i=1,1000 call system_sleep(4.0/1000.0) enddo write(*,(2a))"Time after loop is: ",epoch_to_calendar() end program demo_system_sleepResults:
> Time before integer call is: 2023-10-03 01:11:14 UTC-240 > Time after integer call is: 2023-10-03 01:11:18 UTC-240 > > Time before real call is: 2023-10-03 01:11:18 UTC-240 > Time after real call is: 2023-10-03 01:11:22 UTC-240 > > Time before loop is: 2023-10-03 01:11:22 UTC-240 > Time after loop is: 2023-10-03 01:11:26 UTC-240
John S. Urban, 2015
Public Domain
Nemo Release 3.1 | system_sleep (3m_system) | March 07, 2025 |