… | |
… | |
98 | Libev represents time as a single floating point number, representing the |
98 | Libev represents time as a single floating point number, representing the |
99 | (fractional) number of seconds since the (POSIX) epoch (somewhere near |
99 | (fractional) number of seconds since the (POSIX) epoch (somewhere near |
100 | the beginning of 1970, details are complicated, don't ask). This type is |
100 | the beginning of 1970, details are complicated, don't ask). This type is |
101 | called C<ev_tstamp>, which is what you should use too. It usually aliases |
101 | called C<ev_tstamp>, which is what you should use too. It usually aliases |
102 | to the C<double> type in C, and when you need to do any calculations on |
102 | to the C<double> type in C, and when you need to do any calculations on |
103 | it, you should treat it as such. |
103 | it, you should treat it as some floatingpoint value. Unlike the name |
|
|
104 | component C<stamp> might indicate, it is also used for time differences |
|
|
105 | throughout libev. |
104 | |
106 | |
105 | =head1 GLOBAL FUNCTIONS |
107 | =head1 GLOBAL FUNCTIONS |
106 | |
108 | |
107 | These functions can be called anytime, even before initialising the |
109 | These functions can be called anytime, even before initialising the |
108 | library in any way. |
110 | library in any way. |
… | |
… | |
1220 | |
1222 | |
1221 | The current reschedule callback, or C<0>, if this functionality is |
1223 | The current reschedule callback, or C<0>, if this functionality is |
1222 | switched off. Can be changed any time, but changes only take effect when |
1224 | switched off. Can be changed any time, but changes only take effect when |
1223 | the periodic timer fires or C<ev_periodic_again> is being called. |
1225 | the periodic timer fires or C<ev_periodic_again> is being called. |
1224 | |
1226 | |
|
|
1227 | =item ev_tstamp at [read-only] |
|
|
1228 | |
|
|
1229 | When active, contains the absolute time that the watcher is supposed to |
|
|
1230 | trigger next. |
|
|
1231 | |
1225 | =back |
1232 | =back |
1226 | |
1233 | |
1227 | Example: Call a callback every hour, or, more precisely, whenever the |
1234 | Example: Call a callback every hour, or, more precisely, whenever the |
1228 | system clock is divisible by 3600. The callback invocation times have |
1235 | system clock is divisible by 3600. The callback invocation times have |
1229 | potentially a lot of jittering, but good long-term stability. |
1236 | potentially a lot of jittering, but good long-term stability. |
… | |
… | |
2019 | |
2026 | |
2020 | =item w->stop () |
2027 | =item w->stop () |
2021 | |
2028 | |
2022 | Stops the watcher if it is active. Again, no C<loop> argument. |
2029 | Stops the watcher if it is active. Again, no C<loop> argument. |
2023 | |
2030 | |
2024 | =item w->again () C<ev::timer>, C<ev::periodic> only |
2031 | =item w->again () (C<ev::timer>, C<ev::periodic> only) |
2025 | |
2032 | |
2026 | For C<ev::timer> and C<ev::periodic>, this invokes the corresponding |
2033 | For C<ev::timer> and C<ev::periodic>, this invokes the corresponding |
2027 | C<ev_TYPE_again> function. |
2034 | C<ev_TYPE_again> function. |
2028 | |
2035 | |
2029 | =item w->sweep () C<ev::embed> only |
2036 | =item w->sweep () (C<ev::embed> only) |
2030 | |
2037 | |
2031 | Invokes C<ev_embed_sweep>. |
2038 | Invokes C<ev_embed_sweep>. |
2032 | |
2039 | |
2033 | =item w->update () C<ev::stat> only |
2040 | =item w->update () (C<ev::stat> only) |
2034 | |
2041 | |
2035 | Invokes C<ev_stat_stat>. |
2042 | Invokes C<ev_stat_stat>. |
2036 | |
2043 | |
2037 | =back |
2044 | =back |
2038 | |
2045 | |
… | |
… | |
2058 | } |
2065 | } |
2059 | |
2066 | |
2060 | |
2067 | |
2061 | =head1 MACRO MAGIC |
2068 | =head1 MACRO MAGIC |
2062 | |
2069 | |
2063 | Libev can be compiled with a variety of options, the most fundemantal is |
2070 | Libev can be compiled with a variety of options, the most fundamantal |
2064 | C<EV_MULTIPLICITY>. This option determines whether (most) functions and |
2071 | of which is C<EV_MULTIPLICITY>. This option determines whether (most) |
2065 | callbacks have an initial C<struct ev_loop *> argument. |
2072 | functions and callbacks have an initial C<struct ev_loop *> argument. |
2066 | |
2073 | |
2067 | To make it easier to write programs that cope with either variant, the |
2074 | To make it easier to write programs that cope with either variant, the |
2068 | following macros are defined: |
2075 | following macros are defined: |
2069 | |
2076 | |
2070 | =over 4 |
2077 | =over 4 |