]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
liblib: Added io_loop_time_refresh()
authorTimo Sirainen <tss@iki.fi>
Thu, 15 Sep 2011 10:38:54 +0000 (13:38 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 15 Sep 2011 10:38:54 +0000 (13:38 +0300)
src/lib/ioloop.c
src/lib/ioloop.h

index bd4d4d581907108a813f39057ca2a8ea1141275a..ed1add3e67bb612dc0171adfcda149b8727c2a16 100644 (file)
@@ -425,6 +425,13 @@ bool io_loop_is_running(struct ioloop *ioloop)
         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;
index 41ff6f76af9b0182006dde9e26b0e8bfc4a4dcb9..ef0c6b4e347210c1aa4b019b8b3f59bd3e0e899c 100644 (file)
@@ -78,6 +78,9 @@ void timeout_remove(struct timeout **timeout);
 /* 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 */