… | |
… | |
2123 | Example: Call a callback every hour, or, more precisely, whenever the |
2123 | Example: Call a callback every hour, or, more precisely, whenever the |
2124 | system time is divisible by 3600. The callback invocation times have |
2124 | system time is divisible by 3600. The callback invocation times have |
2125 | potentially a lot of jitter, but good long-term stability. |
2125 | potentially a lot of jitter, but good long-term stability. |
2126 | |
2126 | |
2127 | static void |
2127 | static void |
2128 | clock_cb (struct ev_loop *loop, ev_io *w, int revents) |
2128 | clock_cb (struct ev_loop *loop, ev_periodic *w, int revents) |
2129 | { |
2129 | { |
2130 | ... its now a full hour (UTC, or TAI or whatever your clock follows) |
2130 | ... its now a full hour (UTC, or TAI or whatever your clock follows) |
2131 | } |
2131 | } |
2132 | |
2132 | |
2133 | ev_periodic hourly_tick; |
2133 | ev_periodic hourly_tick; |