from localtime(3)
struct tm *localtime(const time_t *timep);
struct tm {
...
int tm_hour; /* hours */
...
int tm_wday; /* day of the week */
int tm_yday; /* day in the year */
...
};
So I see it going something like this...
in update_handler, you can pick some pulse to stick your code in.
Probably something that doesn't run all that often, like area updating.
{
static int last_ran_this = 0;
struct tm *times = localtime(¤t_time);
if (times->tm_wday == 1
&& times->tm_hour == 0
&& last_ran_this != times->tm_yday)
{
last_ran_this = times->tm_yday;
.. do your thing here ..
}
}
See, we keep track of the last day of the year this was ran on in
last_ran_this, so the code won't execute twice on the same day. Then we just
check the tm structure for day of the week 1 (monday), hour 0 (midnight).
Er, assuming you meant midnight as in monday morning, otherwise adjust
accordingly.
--Palrich.