#include<stdio.h>
#include <time.h>
int main ()
{enter code here
time_t now;
struct tm timespace;
double seconds;
struct timespec t = { 2/*seconds*/, 0/*nanoseconds*/};
while (1){
time(&now);
seconds=now;
printf ("%.f Timer Counter\n", seconds);
timespace = *localtime(&now);
nanosleep(&t,NULL);
time(&now);
seconds=now;
fflush(stdout);
printf ("%.f Counter Value After two second delay.\n Hellow.\n", seconds);
seconds=now;
printf("\n\n\n");
timespace = *localtime(&now);
nanosleep(&t,NULL);
fflush(stdout);
time(&now);
seconds=now;
printf ("%.f Counter Value After two second delay.\n Hello World 2.\n", seconds);
return 0;
}
}
every time i compile this code it says
variable `timespec t' has initializer but incomplete type
and
'nanosleep' undeclared (first use this function)
Aucun commentaire:
Enregistrer un commentaire