@ -6,9 +6,10 @@ Revision history for libev, a high-performance and full-featured event loop.
- disable epoll_create1 on android because it has broken header files
and google is unwilling to fix them (reported by firstname.lastname@example.org).
- avoid a minor compilation warning on win32.
- c++: rename EV_THROW to EV_NOEXCEPT
- c++: rename EV_THROW to EV_NOEXCEPT.
- c++: remove deprecated dynamic throw() specifications.
- c++: improve the (unsupported) bad_loop exception class.
- backport perl ev_periodic example to C, untested.
4.24 Wed Dec 28 05:19:55 CET 2016
- bump version to 4.24, as the release tarball inexplicably
@ -1,7 +1,7 @@
* libev simple C++ wrapper classes
* Copyright (c) 2007,2008,2010 Marc Alexander Lehmann <email@example.com>
* Copyright (c) 2007,2008,2010,2018 Marc Alexander Lehmann <firstname.lastname@example.org>
* All rights reserved.
* Redistribution and use in source and binary forms, with or without modifica-
* libev event processing core, watcher management
* Copyright (c) 2007,2008,2009,2010,2011,2012,2013 Marc Alexander Lehmann <email@example.com>
* Copyright (c) 2007-2018 Marc Alexander Lehmann <firstname.lastname@example.org>
* libev native API header
* Copyright (c) 2007,2008,2009,2010,2011,2012,2015 Marc Alexander Lehmann <email@example.com>
@ -2227,8 +2227,8 @@ it, as it uses a relative timeout).
C<ev_periodic> watchers can also be used to implement vastly more complex
timers, such as triggering an event on each "midnight, local time", or
other complicated rules. This cannot be done with C<ev_timer> watchers, as
those cannot react to time jumps.
other complicated rules. This cannot easily be done with C<ev_timer>
watchers, as those cannot react to time jumps.
As with timers, the callback is guaranteed to be invoked only when the
point in time where it is supposed to trigger has passed. If multiple
@ -2324,10 +2324,28 @@ NOTE: I<< This callback must always return a time that is higher than or
equal to the passed C<now> value >>.
This can be used to create very complex timers, such as a timer that
triggers on "next midnight, local time". To do this, you would calculate the
next midnight after C<now> and return the timestamp value for this. How
you do this is, again, up to you (but it is not trivial, which is the main
reason I omitted it as an example).
triggers on "next midnight, local time". To do this, you would calculate
the next midnight after C<now> and return the timestamp value for
this. Here is a (completely untested, no error checking) example on how to
my_rescheduler (ev_periodic *w, ev_tstamp now)
time_t tnow = (time_t)now;
struct tm tm;
localtime_r (&tnow, &tm);
tm.tm_sec = tm.tm_min = tm.tm_hour = 0; // midnight current day
++tm.tm_mday; // midnight next day
return mktime (&tm);
Note: this code might run into trouble on days that have more then two
midnights (beginning and end).