comparison mtctest/main.c @ 159:c8e9b295e88f

mtctest: add time reporting for DTMF events
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 12 Oct 2022 12:11:06 -0800
parents a065b4a62a8a
children
comparison
equal deleted inserted replaced
158:51cf5ea7f320 159:c8e9b295e88f
1 /* 1 /*
2 * Main module for ThemWi test MT call generator. 2 * Main module for ThemWi test MT call generator.
3 */ 3 */
4 4
5 #include <sys/types.h> 5 #include <sys/types.h>
6 #include <sys/time.h>
6 #include <sys/errno.h> 7 #include <sys/errno.h>
7 #include <stdio.h> 8 #include <stdio.h>
8 #include <stdint.h> 9 #include <stdint.h>
9 #include <stdlib.h> 10 #include <stdlib.h>
10 #include <syslog.h> 11 #include <syslog.h>
11 #include <unistd.h> 12 #include <unistd.h>
12 13
13 extern int mtc_socket; 14 extern int mtc_socket;
14 extern int disconnect_mode; 15 extern int disconnect_mode;
16
17 struct timeval cur_event_time;
15 18
16 static void 19 static void
17 drain_stdin() 20 drain_stdin()
18 { 21 {
19 char buf[256]; 22 char buf[256];
62 if (errno == EINTR) 65 if (errno == EINTR)
63 continue; 66 continue;
64 perror("select"); 67 perror("select");
65 exit(1); 68 exit(1);
66 } 69 }
70 gettimeofday(&cur_event_time, 0);
67 if (FD_ISSET(mtc_socket, &fds)) 71 if (FD_ISSET(mtc_socket, &fds))
68 mtc_socket_select(); 72 mtc_socket_select();
69 if (!disconnect_mode && FD_ISSET(0, &fds)) { 73 if (!disconnect_mode && FD_ISSET(0, &fds)) {
70 drain_stdin(); 74 drain_stdin();
71 send_disconnect_req(); 75 send_disconnect_req();