Implement patty_ax25_timer_ack_set()
Implement patty_ax25_timer_ack_set() to set a timer to at least the value indicated in Timer T1
This commit is contained in:
parent
7ed169d7cc
commit
499445d8b1
2 changed files with 14 additions and 0 deletions
|
@ -102,6 +102,9 @@ void patty_ax25_sock_timer_ack_restart(patty_ax25_sock *sock);
|
|||
|
||||
void patty_ax25_sock_timer_ack_cancel(patty_ax25_sock *sock);
|
||||
|
||||
void patty_ax25_sock_timer_ack_set(patty_ax25_sock *sock,
|
||||
struct timeval *timer);
|
||||
|
||||
void patty_ax25_sock_timer_ack_sub(patty_ax25_sock *sock,
|
||||
struct timeval *elapsed);
|
||||
|
||||
|
|
11
src/sock.c
11
src/sock.c
|
@ -192,6 +192,17 @@ void patty_ax25_sock_timer_ack_cancel(patty_ax25_sock *sock) {
|
|||
sock->timer_ack.tv_usec = 0;
|
||||
}
|
||||
|
||||
void patty_ax25_sock_timer_ack_set(patty_ax25_sock *sock,
|
||||
struct timeval *timer) {
|
||||
if (timercmp(&sock->timer_ack, timer, >)) {
|
||||
struct timeval res;
|
||||
|
||||
timeradd(timer, &sock->timer_ack, &res);
|
||||
|
||||
memcpy(timer, &res, sizeof(*timer));
|
||||
}
|
||||
}
|
||||
|
||||
void patty_ax25_sock_timer_ack_sub(patty_ax25_sock *sock,
|
||||
struct timeval *elapsed) {
|
||||
struct timeval res;
|
||||
|
|
Loading…
Add table
Reference in a new issue