dovecot-2.0: liblib: Added io_loop_time_refresh()

dovecot at dovecot.org dovecot at dovecot.org
Thu Sep 15 13:48:37 EEST 2011


details:   http://hg.dovecot.org/dovecot-2.0/rev/3334c12a2b1a
changeset: 12914:3334c12a2b1a
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Sep 15 13:38:54 2011 +0300
description:
liblib: Added io_loop_time_refresh()

diffstat:

 src/lib/ioloop.c |  7 +++++++
 src/lib/ioloop.h |  3 +++
 2 files changed, 10 insertions(+), 0 deletions(-)

diffs (30 lines):

diff -r 0dffdc3bfad1 -r 3334c12a2b1a src/lib/ioloop.c
--- 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;
diff -r 0dffdc3bfad1 -r 3334c12a2b1a src/lib/ioloop.h
--- 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 */
 


More information about the dovecot-cvs mailing list