Browse Source

*** empty log message ***

master
Marc Alexander Lehmann 2 years ago
parent
commit
5c67827465
5 changed files with 29 additions and 10 deletions
  1. +2
    -1
      Changes
  2. +1
    -1
      ev++.h
  3. +1
    -1
      ev.c
  4. +1
    -1
      ev.h
  5. +24
    -6
      ev.pod

+ 2
- 1
Changes View File

@ -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 enh@google.com).
- 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
- 1
ev++.h View File

@ -1,7 +1,7 @@
/*
* libev simple C++ wrapper classes
*
* Copyright (c) 2007,2008,2010 Marc Alexander Lehmann <libev@schmorp.de>
* Copyright (c) 2007,2008,2010,2018 Marc Alexander Lehmann <libev@schmorp.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-


+ 1
- 1
ev.c View File

@ -1,7 +1,7 @@
/*
* libev event processing core, watcher management
*
* Copyright (c) 2007,2008,2009,2010,2011,2012,2013 Marc Alexander Lehmann <libev@schmorp.de>
* Copyright (c) 2007-2018 Marc Alexander Lehmann <libev@schmorp.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-


+ 1
- 1
ev.h View File

@ -1,7 +1,7 @@
/*
* libev native API header
*
* Copyright (c) 2007,2008,2009,2010,2011,2012,2015 Marc Alexander Lehmann <libev@schmorp.de>
* Copyright (c) 2007-2018 Marc Alexander Lehmann <libev@schmorp.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-


+ 24
- 6
ev.pod View File

@ -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
do this:
#include <time.h>
static ev_tstamp
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).
=back


Loading…
Cancel
Save