diff options
Diffstat (limited to 'src/recv.c')
-rw-r--r-- | src/recv.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -28,7 +28,6 @@ #include <stdio.h> #include <string.h> #include <unistd.h> -#include <sys/time.h> #include "recv.h" #include "socket.h" @@ -105,9 +104,9 @@ gint recv_write(SockInfo *sock, FILE *fp) gint len; gint count = 0; gint bytes = 0; - struct timeval tv_prev, tv_cur; + GTimeVal tv_prev, tv_cur; - gettimeofday(&tv_prev, NULL); + g_get_current_time(&tv_prev); for (;;) { if (sock_gets(sock, buf, sizeof(buf)) < 0) { @@ -126,7 +125,7 @@ gint recv_write(SockInfo *sock, FILE *fp) bytes += len; if (recv_ui_func) { - gettimeofday(&tv_cur, NULL); + g_get_current_time(&tv_cur); /* if elapsed time from previous update is greater than 50msec, update UI */ if (tv_cur.tv_sec - tv_prev.tv_sec > 0 || @@ -135,7 +134,7 @@ gint recv_write(SockInfo *sock, FILE *fp) ret = recv_ui_func(sock, count, bytes, recv_ui_func_data); if (ret == FALSE) return -1; - gettimeofday(&tv_prev, NULL); + g_get_current_time(&tv_prev); } } |