--- embedaddon/iperf/src/timer.h 2016/10/18 13:28:18 1.1.1.1 +++ embedaddon/iperf/src/timer.h 2021/03/17 00:36:46 1.1.1.2 @@ -30,8 +30,11 @@ #ifndef __TIMER_H #define __TIMER_H +#include #include +#include "iperf_time.h" + /* TimerClientData is an opaque value that tags along with a timer. The ** client can use it for whatever, and it gets passed to the callback when ** the timer triggers. @@ -46,10 +49,10 @@ typedef union extern TimerClientData JunkClientData; /* for use when you don't care */ /* The TimerProc gets called when the timer expires. It gets passed -** the TimerClientData associated with the timer, and a timeval in case +** the TimerClientData associated with the timer, and a iperf_time in case ** it wants to schedule another timer. */ -typedef void TimerProc( TimerClientData client_data, struct timeval* nowP ); +typedef void TimerProc( TimerClientData client_data, struct iperf_time* nowP ); /* The Timer struct. */ typedef struct TimerStruct @@ -58,7 +61,7 @@ typedef struct TimerStruct TimerClientData client_data; int64_t usecs; int periodic; - struct timeval time; + struct iperf_time time; struct TimerStruct* prev; struct TimerStruct* next; int hash; @@ -66,22 +69,22 @@ typedef struct TimerStruct /* Set up a timer, either periodic or one-shot. Returns (Timer*) 0 on errors. */ extern Timer* tmr_create( - struct timeval* nowP, TimerProc* timer_proc, TimerClientData client_data, + struct iperf_time* nowP, TimerProc* timer_proc, TimerClientData client_data, int64_t usecs, int periodic ); /* Returns a timeout indicating how long until the next timer triggers. You ** can just put the call to this routine right in your select(). Returns ** (struct timeval*) 0 if no timers are pending. */ -extern struct timeval* tmr_timeout( struct timeval* nowP ) /* __attribute__((hot)) */; +extern struct timeval* tmr_timeout( struct iperf_time* nowP ) /* __attribute__((hot)) */; /* Run the list of timers. Your main program needs to call this every so often, ** or as indicated by tmr_timeout(). */ -extern void tmr_run( struct timeval* nowP ) /* __attribute__((hot)) */; +extern void tmr_run( struct iperf_time* nowP ) /* __attribute__((hot)) */; /* Reset the clock on a timer, to current time plus the original timeout. */ -extern void tmr_reset( struct timeval* nowP, Timer* timer ); +extern void tmr_reset( struct iperf_time* nowP, Timer* timer ); /* Deschedule a timer. Note that non-periodic timers are automatically ** descheduled when they run, so you don't have to call this on them.