… | |
… | |
21 | #include <cstdlib> |
21 | #include <cstdlib> |
22 | #include <cerrno> |
22 | #include <cerrno> |
23 | |
23 | |
24 | #include <sys/time.h> |
24 | #include <sys/time.h> |
25 | |
25 | |
26 | #if 1 // older unices need these includes for select(2) |
26 | #if 1 // older unices need these includes for select (2) |
27 | # include <unistd.h> |
27 | # include <unistd.h> |
28 | # include <sys/types.h> |
28 | # include <sys/types.h> |
29 | #endif |
29 | #endif |
30 | |
30 | |
31 | // if the BSDs would at least be marginally POSIX-compatible.. *sigh* |
31 | // if the BSDs would at least be marginally POSIX-compatible.. *sigh* |
… | |
… | |
49 | // reached end-of-time, or tstamp has a bogus definition, |
49 | // reached end-of-time, or tstamp has a bogus definition, |
50 | // or compiler initilization order broken, or somethine else :) |
50 | // or compiler initilization order broken, or somethine else :) |
51 | abort (); |
51 | abort (); |
52 | } |
52 | } |
53 | |
53 | |
54 | tw0() |
54 | tw0 () |
55 | : time_watcher (this, &tw0::cb) |
55 | : time_watcher (this, &tw0::cb) |
56 | { }} |
56 | { }} |
57 | tw0; |
57 | tw0; |
58 | |
58 | |
59 | tstamp NOW; |
59 | tstamp NOW; |
… | |
… | |
166 | { |
166 | { |
167 | if (next != tw[0]) |
167 | if (next != tw[0]) |
168 | { |
168 | { |
169 | double diff = next->at - NOW; |
169 | double diff = next->at - NOW; |
170 | tval.tv_sec = (int)diff; |
170 | tval.tv_sec = (int)diff; |
171 | tval.tv_usec = (int)((diff - tval.tv_sec) * 1000000); |
171 | tval.tv_usec = (int) ((diff - tval.tv_sec) * 1000000); |
172 | to = &tval; |
172 | to = &tval; |
173 | } |
173 | } |
174 | break; |
174 | break; |
175 | } |
175 | } |
176 | else |
176 | else |