using namespace std;
#include <iostream>
#include <sys/time.h>

void timer_handler(int x) {
	signal(SIGALRM, timer_handler); // reset, so it timers more than once
	cout << "timer" << endl;
}

int main() {
	struct itimerval timer1;

	signal(SIGALRM, timer_handler);
	cout << "Start" << endl;

	timer1.it_interval.tv_sec = 0;
	timer1.it_interval.tv_usec = 250000;
	timer1.it_value.tv_sec = 1;
	timer1.it_value.tv_usec = 0;

	setitimer(ITIMER_REAL, &timer1, NULL);

	double i; // give the motors time to spin down before exiting
	for (i = 0; i < 500000000; i++) {
	}
	

	return 1;
}

