diff options
Diffstat (limited to 'emacs/xml_interface.c')
-rw-r--r-- | emacs/xml_interface.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/emacs/xml_interface.c b/emacs/xml_interface.c index 7db2c63..2f4ebba 100644 --- a/emacs/xml_interface.c +++ b/emacs/xml_interface.c @@ -329,8 +329,10 @@ int main (int argc, char **argv) { fd_set read_fds, write_fds; int nfds; - struct timeval tv; - struct timeval *mtv; + struct timespec tv; + struct timespec *mtv; + struct timeval tv_ms; + struct timeval *mtv_ms; int n = 0; do { @@ -367,7 +369,13 @@ int main (int argc, char **argv) { FD_ZERO(&read_fds); FD_ZERO(&write_fds); nfds = rexmpp_fds(&s, &read_fds, &write_fds); - mtv = rexmpp_timeout(&s, NULL, (struct timeval*)&tv); + mtv = rexmpp_timeout(&s, NULL, &tv); + mtv_ms = NULL; + if (mtv != NULL) { + tv_ms.tv_sec = mtv->tv_sec; + tv_ms.tv_usec = mtv->tv_nsec / 1000; + mtv_ms = &tv_ms; + } /* Add other file descriptors we are interested in, particularly stdin for user input. */ @@ -375,7 +383,7 @@ int main (int argc, char **argv) { /* Run select(2) with all those file descriptors and timeouts, waiting for either user input or some rexmpp event to occur. */ - n = select(nfds, &read_fds, &write_fds, NULL, mtv); + n = select(nfds, &read_fds, &write_fds, NULL, mtv_ms); if (n == -1) { printf("select error: %s\n", strerror(errno)); break; |