]> granicus.if.org Git - libevent/commitdiff
Use evutil_gettimeofday instead of relying on the system gettimeofday.
authorPeter Rosin <peda@lysator.liu.se>
Wed, 25 May 2011 13:11:01 +0000 (15:11 +0200)
committerNick Mathewson <nickm@torproject.org>
Wed, 25 May 2011 23:44:06 +0000 (19:44 -0400)
test/bench.c
test/bench_cascade.c
test/bench_httpclient.c

index 1d25076efcb6324b97e357e6df484539b53fc941..d0f831b9f80723889c3270e14371dd4fd78099bd 100644 (file)
@@ -107,12 +107,12 @@ run_once(void)
        count = 0;
        writes = num_writes;
        { int xcount = 0;
-       gettimeofday(&ts, NULL);
+       evutil_gettimeofday(&ts, NULL);
        do {
                event_loop(EVLOOP_ONCE | EVLOOP_NONBLOCK);
                xcount++;
        } while (count != fired);
-       gettimeofday(&te, NULL);
+       evutil_gettimeofday(&te, NULL);
 
        if (xcount != count) fprintf(stderr, "Xcount: %d, Rcount: %d\n", xcount, count);
        }
index 908c61701c738f1fb3327b7160e0f586afe4b4c2..c25255edd244bf42cba173a65ac2e8cab490e4df 100644 (file)
@@ -97,7 +97,7 @@ run_once(int num_pipes)
        }
 
        /* measurements includes event setup */
-       gettimeofday(&ts, NULL);
+       evutil_gettimeofday(&ts, NULL);
 
        /* provide a default timeout for events */
        evutil_timerclear(&tv_timeout);
@@ -116,7 +116,7 @@ run_once(int num_pipes)
 
        event_dispatch();
 
-       gettimeofday(&te, NULL);
+       evutil_gettimeofday(&te, NULL);
        evutil_timersub(&te, &ts, &te);
 
        for (cp = pipes, i = 0; i < num_pipes; i++, cp += 2) {
index 87103cc87d84a6d428360537fbf718f203c79a84..25db4a7d8c4eeb6183532be0cd900bf1a91e5aa4 100644 (file)
@@ -88,7 +88,7 @@ errorcb(struct bufferevent *b, short what, void *arg)
        if (what & BEV_EVENT_EOF) {
                ++total_n_handled;
                total_n_bytes += ri->n_read;
-               gettimeofday(&now, NULL);
+               evutil_gettimeofday(&now, NULL);
                evutil_timersub(&now, &ri->started, &diff);
                evutil_timeradd(&diff, &total_time, &total_time);
 
@@ -152,7 +152,7 @@ launch_request(void)
 
        ri = malloc(sizeof(*ri));
        ri->n_read = 0;
-       gettimeofday(&ri->started, NULL);
+       evutil_gettimeofday(&ri->started, NULL);
 
        b = bufferevent_socket_new(base, sock, BEV_OPT_CLOSE_ON_FREE);
 
@@ -184,11 +184,11 @@ main(int argc, char **argv)
                        perror("launch");
        }
 
-       gettimeofday(&start, NULL);
+       evutil_gettimeofday(&start, NULL);
 
        event_base_dispatch(base);
 
-       gettimeofday(&end, NULL);
+       evutil_gettimeofday(&end, NULL);
        evutil_timersub(&end, &start, &total);
        usec = total_time.tv_sec * 1000000 + total_time.tv_usec;