#include <pthread.h>
int
sleep
(unsigned int
seconds );
The sleep function delays the execution of the calling thread by at least the given number of seconds.
The sleep function returns zero if successful, or -1 in the event of an error.
Using GCC-1750 the maximum sleep time is 32767 seconds, or approximately 9 hours.
GCC-ERC32 uses a 32-bit value for the maximum sleep time.
Section 14.4.3 |
#include <pthread.h>
int
clock_gettime
(int
clock_id , struct timespec * tp );
The clock_gettime function gets the time from the given clock.
The clock_gettime function returns zero if successful and -1 otherwise.
The value of clock_id must be CLOCK_REALTIME.
#include <pthread.h>
int
nanosleep
(const struct timespec * rqtp , struct timespec * rmtp );
The nanosleep function delays the execution of the calling thread until either the time interval given by rtqp has elapsed or a signal is handled by the thread.
The nanosleep function returns zero to indicate the given time interval has elapsed. Otherwise it returns -1 to indicate that the delay has been interrupted, and sets rmtp to the time interval remaining.
The resolution of nanosleep is determined by the interrupt period of the real time clock. This is set to 10 mSec in the file crt0.
The maximum time interval is 2147483647.999 seconds, or approximately 68 years.
Section 14.4.1 |