I haven't programmed any C in a while, so you might have to tweak this a little to get it to work, but basically, what you are doing wrong is trying to pass an int where a struct is expected ...
You need to
Code:
#include <time.h>
...
...
int seconds = 10;
long int nanosecs = 1500;
struct timespec foo;
foo.tv_sec = (time_t) seconds;
foo.tv_nsec = nanosecs;
...
...
nanosleep(&foo, NULL);
i.e. You need to pass it a pointer to a struct, not an integer value.
(see
man nanosleep for details)