Skip to content

Instantly share code, notes, and snippets.

@emmiegit
Created October 1, 2021 01:35
Show Gist options
  • Select an option

  • Save emmiegit/ad5be96bd2e6fe5f06b8e33290273f53 to your computer and use it in GitHub Desktop.

Select an option

Save emmiegit/ad5be96bd2e6fe5f06b8e33290273f53 to your computer and use it in GitHub Desktop.
#define _XOPEN_SOURCE 500
#include <limits.h>
#include <time.h>
#define MAX_INT(t) ((1UL << (CHAR_BIT * sizeof(t) - 1UL)) - 1UL)
int main(void)
{
struct timespec ts;
ts.tv_sec = MAX_INT(time_t);
ts.tv_nsec = 0;
for (;;) {
if (nanosleep(&ts, NULL))
return 1;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment