Return to test-nanosleep.c CVS log | Up to [cvsweb.bsd.lv] / mandoc |
File: [cvsweb.bsd.lv] / mandoc / test-nanosleep.c (download)
Revision 1.1, Wed Jul 20 14:03:06 2016 UTC (8 years, 2 months ago) by schwarze
Autodetect if -lrt is needed for nanosleep(3). Helpful for Solaris 9 and 10. Reminded by Thomas Klausner. |
#include <stdio.h> #include <time.h> int main(void) { struct timespec timeout; timeout.tv_sec = 0; timeout.tv_nsec = 100000000; /* 0.1 seconds */ if (nanosleep(&timeout, NULL)) { perror("nanosleep"); return 1; } return 0; }