Plan 9 from Bell Labs’s /usr/web/sources/contrib/oraccha/iperf3/t_timer.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>

#include "timer.h"

int 
main(int argc, char **argv)
{
    struct timer *tp;
    tp = new_timer(3, 0);

    sleep(2);

    if (tp->expired(tp))
    {
	printf("timer should not have expired\n");
	exit(-1);
    }
    sleep(1);

    if (!tp->expired(tp))
    {
	printf("timer should have expired\n");
	exit(-2);
    }
    exit(0);
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.