Hey Guys,
i've created the following program, which outputs the string 'output' once a second.
my question is, i was wondering how one would time intervals of less than 1 second in C and C++? for example, if i wanted to output the string 'output' every 0.5 of a second or 0.25 of a second etc.Code:#include <stdio.h>
#include <time.h>
int main(){
time_t cal_tm;
time_t lst_tm;
cal_tm=time(NULL);
lst_tm=cal_tm;
while(1){
cal_tm=time(NULL);
if(cal_tm>lst_tm){
printf("output\n");
lst_tm=cal_tm;
}
}
}
thanks in advance,
- user0182