timer and alarm frustration

I have this program:

#include <sys/time.h>
#include <signal.h>
#include <stdlib.h>
#include <errno.h>
#include <stdio.h>


#define LOOP_LIMIT 1E12

volatile int sigcount=0;


int main(int argc, char** argv) {
struct itimerval value;

value.it_interval.tv_sec = 0;
value.it_interval.tv_usec = 200000;
value.it_value.tv_sec = 5;
value.it_value.tv_usec = 0;

setitimer(ITIMER_REAL, &value, 0);
getitimer(ITIMER_REAL,0,0)
int count;
for( count=0; ((count<LOOP_LIMIT) && (sigcount<40)); count++ ){
if (count%5000000 == 0)
printf("Time goes by...count=%d\n", count);
}
if (int value==0)
printf("An Alarm just went off!",sigcount++);
printf( "At the end, count=%d and alarms=%d\n", count, sigcount );
return 0;
}

for homework im supposed to modify it that every time the registered timer expires,the program prints "An alarm went off!" and then increments the value of the variable sigcount.

then after that im supposed to use setitimer(ITIMER_REAL,0,0); which will disable the real timer(if set) to modify the program after the 5 alarms have been recieved.

I know my code is not even close to being right and i desperately need help.Please,if anybody knows how i can fix this mess can you show me with the actual code to do it in.I know im supposed to learn this on my own,but if i have no clue what im doing,im not learning anything either.......please help.
Topic archived. No new replies allowed.