Mercurial > dovecot > core-2.2
changeset 13489:3334c12a2b1a
liblib: Added io_loop_time_refresh()
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 15 Sep 2011 13:38:54 +0300 |
parents | 0dffdc3bfad1 |
children | c056bd23fdcc |
files | src/lib/ioloop.c src/lib/ioloop.h |
diffstat | 2 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib/ioloop.c Thu Sep 15 13:09:50 2011 +0300 +++ b/src/lib/ioloop.c Thu Sep 15 13:38:54 2011 +0300 @@ -425,6 +425,13 @@ return ioloop->running; } +void io_loop_time_refresh(void) +{ + if (gettimeofday(&ioloop_timeval, NULL) < 0) + i_fatal("gettimeofday(): %m"); + ioloop_time = ioloop_timeval.tv_sec; +} + struct ioloop *io_loop_create(void) { struct ioloop *ioloop;
--- a/src/lib/ioloop.h Thu Sep 15 13:09:50 2011 +0300 +++ b/src/lib/ioloop.h Thu Sep 15 13:38:54 2011 +0300 @@ -78,6 +78,9 @@ /* Reset timeout so it's next run after now+msecs. */ void timeout_reset(struct timeout *timeout); +/* Refresh ioloop_time and ioloop_timeval variables. */ +void io_loop_time_refresh(void); + void io_loop_run(struct ioloop *ioloop); void io_loop_stop(struct ioloop *ioloop); /* safe to run in signal handler */