I whant to creat a wait function witch waits for x number of seconds and that is intruppteabel (does that word exsist?) if you press a key Iīve tryed a huge numbers of differnt ways but none works here is my laters try (note I havenīt added the interupt part yet) :

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

int main (){
int w;         //seconds you whant to wait
time_t time  = time (NULL);
w=time+2;
for (;time==w; time_t time =time(NULL)){
               //the code looks for a key being pressed//
}
}