clock_gettime(0,&t); t.tv_sec++; DDRB = 0xff; for(int i=0; i<10000; i++) { DRB = val; int ret = clock_nanosleep(0, TIMER_ABSTIME, &t, NULL); val =! val; t.tv_nsec+= 100000; tsnorm(&t); //normalizes time so that tv_nsec overflows into tv_sec }