Hi there,
This is probably a question you get quite often, but I cannot seem to find the answer in the FAQ nor can I find it in searching through this web site, so sorry about this.
I am coding IRC Services, and everything works great, probably could be fixed up a tad, but that's not the issue here, so I'll stop rambling. I was wondering if it was possible to create a timer that runs a command every X minutes (changeable depending on the command you want to run), for example, timer_add(3600, (void*)some_cmd()); to create a timer that runs every hour, or possibly once an hour, because at the end of 'some_cmd()', I can just chuck it there.
I have looked through the time.h and cannot see any way to do this. I have made structures with things stored, for example...
This isn't the one I used, but it is similar, and I created loops to allocate memory to it and everything, that seems all right, but I just can't figure out how to call upon it every X seconds/minutes.Code:typedef struct zTimer aTimer; struct zTimer { char *name; int *often; time_t starttime; aTimer *next, *prev; };
As you know, I can't use sleep(); because this halts everything, and IRC Services don't run too well if all commands are halted
Any help would be MUCH appreciated, thanks again.



LinkBack URL
About LinkBacks



