You are not logged in.
Pages: 1
Hi,
I want to write a C program which generations different events bases on current time slot of the day.
Can any one please let me know which library will be best suitable for this ? eg
infinite_loop {
if (2am to 4 am)
generate event A;
if (4am to 6 am)
generate event A;
if (6am to 8 am)
generate event A;
...........
...........
}
Thanks
Offline
Well, I'm not sure what exactly you mean by "generate events"... Are you talking about sending signals or writing to a pipe or calling some callback function or something else?
But, the time-based stuff is easy enough, and doesn't require any library beyond standard libc... Just use either time() or if you need subsecond precision gettimeofday()... Then, localtime() to break it down into an easily parsable local time struct so you can easily do the type of time differentiation you seem to be wanting...
Offline
Pages: 1