Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit dba1a49a authored by rswindell's avatar rswindell

Ignore disabled events when calculating time until next event in gettimeleft().

Don't LOG negative time-left in gettimeleft().
parent 77027966
......@@ -178,7 +178,8 @@ void sbbs_t::gettimeleft(void)
event_time=0;
for(i=0;i<cfg.total_events;i++) {
if(!cfg.event[i]->node || cfg.event[i]->node>cfg.sys_nodes)
if(!cfg.event[i]->node || cfg.event[i]->node>cfg.sys_nodes
|| cfg.event[i]->misc&EVENT_DISABLED)
continue;
if(!(cfg.event[i]->misc&EVENT_FORCE)
|| (!(cfg.event[i]->misc&EVENT_EXCL) && cfg.event[i]->node!=cfg.node_num)
......@@ -186,12 +187,14 @@ void sbbs_t::gettimeleft(void)
|| (cfg.event[i]->mdays!=0 && !(cfg.event[i]->mdays&(1<<tm.tm_mday))))
continue;
if(localtime_r(&cfg.event[i]->last,&last_tm)==NULL)
memset(&last_tm,0,sizeof(last_tm));
tm.tm_hour=cfg.event[i]->time/60; /* hasn't run yet today */
tm.tm_min=cfg.event[i]->time-(tm.tm_hour*60);
tm.tm_hour=cfg.event[i]->time/60;
tm.tm_min=cfg.event[i]->time%60;
tm.tm_sec=0;
thisevent=mktime(&tm);
if(localtime_r(&cfg.event[i]->last,&last_tm)==NULL)
memset(&last_tm,0,sizeof(last_tm));
if(tm.tm_mday==last_tm.tm_mday && tm.tm_mon==last_tm.tm_mon)
thisevent+=24L*60L*60L; /* already ran today, so add 24hrs */
if(!event_time || thisevent<event_time) {
......@@ -200,7 +203,10 @@ void sbbs_t::gettimeleft(void)
}
}
if(event_time && now+(time_t)timeleft>event_time) { /* less time, set flag */
timeleft=event_time-now;
if(event_time<now)
timeleft=0;
else
timeleft=event_time-now;
if(!(sys_status&SS_EVENT)) {
lprintf(LOG_NOTICE,"Node %d Time reduced (to %s) due to upcoming event (%s) on %s"
,cfg.node_num,sectostr(timeleft,tmp),event_code,timestr(&event_time));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment