Browse Source

remove caching of current time

it's too hard to reliably predict when invalidation will be necessary.
wip/server-refactor
Oswald Buddenhagen 10 years ago
parent
commit
5c4015aee5
  1. 11
      src/util.c

11
src/util.c

@ -688,17 +688,10 @@ wipe_notifier( notifier_t *sn )
#endif #endif
} }
static int nowvalid;
static time_t now;
static time_t static time_t
get_now( void ) get_now( void )
{ {
if (!nowvalid) { return time( 0 );
nowvalid = 1;
return time( &now );
}
return now;
} }
static list_head_t timers = { &timers, &timers }; static list_head_t timers = { &timers, &timers };
@ -764,7 +757,6 @@ event_wait( void )
#ifdef HAVE_SYS_POLL_H #ifdef HAVE_SYS_POLL_H
int timeout = -1; int timeout = -1;
nowvalid = 0;
if ((head = timers.next) != &timers) { if ((head = timers.next) != &timers) {
wakeup_t *tmr = (wakeup_t *)head; wakeup_t *tmr = (wakeup_t *)head;
time_t delta = tmr->timeout; time_t delta = tmr->timeout;
@ -801,7 +793,6 @@ event_wait( void )
fd_set rfds, wfds, efds; fd_set rfds, wfds, efds;
int fd; int fd;
nowvalid = 0;
if ((head = timers.next) != &timers) { if ((head = timers.next) != &timers) {
wakeup_t *tmr = (wakeup_t *)head; wakeup_t *tmr = (wakeup_t *)head;
time_t delta = tmr->timeout; time_t delta = tmr->timeout;

Loading…
Cancel
Save