¿Cómo usar nanosleep () en C? ¿Qué son `tim.tv_sec` y` tim.tv_nsec`?

Cuál es el uso detim.tv_sec ytim.tv_nsec ¿en el siguiente

¿Cómo puedo dormir ejecución para500000 microsegundos?

#include <stdio.h>
#include <time.h>

int main()
{
   struct timespec tim, tim2;
   tim.tv_sec = 1;
   tim.tv_nsec = 500;

   if(nanosleep(&tim , &tim2) < 0 )   
   {
      printf("Nano sleep system call failed \n");
      return -1;
   }

   printf("Nano sleep successfull \n");

   return 0;
}

Respuestas a la pregunta(6)

Su respuesta a la pregunta