#include #include #include #include static void foo(int n) { } int main(int argc, char *argv[]) { struct timespec ts, tr; int error; ts.tv_sec = 2; ts.tv_nsec = 3; signal(SIGINT, foo); for (;;) { error = nanosleep(&ts, &tr); printf("%d %jd.%jd\n", error, (intmax_t)tr.tv_sec, (intmax_t)tr.tv_nsec); continue; } return 0; }