diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2017-06-06 16:47:30 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2017-12-07 13:49:27 +0100 |
commit | f047271cb963c62663687d63b2f7cf8dd5edfbb7 (patch) | |
tree | cec19ec5f00167aabc3a5233cef5bc6c5e384526 /proto/bfd | |
parent | 025525266f6861437ca54aca2a86eb505a486baf (diff) |
Timers: Parse and format functions for microsecond times
Date/time output (e.g. in logs, show commands) can use %f to specify
subsecond time. By default, millisecond precision is used in output.
Diffstat (limited to 'proto/bfd')
-rw-r--r-- | proto/bfd/bfd.c | 8 | ||||
-rw-r--r-- | proto/bfd/bfd.h | 2 |
2 files changed, 4 insertions, 6 deletions
diff --git a/proto/bfd/bfd.c b/proto/bfd/bfd.c index e2c6050b..2374cfe8 100644 --- a/proto/bfd/bfd.c +++ b/proto/bfd/bfd.c @@ -145,6 +145,7 @@ bfd_session_update_state(struct bfd_session *s, uint state, uint diag) bfd_lock_sessions(p); s->loc_state = state; s->loc_diag = diag; + s->last_state_change = current_time(); notify = !NODE_VALID(&s->n); if (notify) @@ -438,7 +439,7 @@ bfd_add_session(struct bfd_proto *p, ip_addr addr, ip_addr local, struct iface * bfd_session_control_tx_timer(s, 1); init_list(&s->request_list); - s->last_state_change = now; + s->last_state_change = current_time(); TRACE(D_EVENTS, "Session to %I added", s->addr); @@ -879,9 +880,6 @@ bfd_notify_hook(sock *sk, uint len UNUSED) diag = s->loc_diag; bfd_unlock_sessions(p); - /* FIXME: convert to btime and move to bfd_session_update_state() */ - s->last_state_change = now; - s->notify_running = 1; WALK_LIST_DELSAFE(n, nn, s->request_list) bfd_request_notify(SKIP_BACK(struct bfd_request, n, n), state, diag); @@ -1105,7 +1103,7 @@ bfd_show_sessions(struct proto *P) timeout = (MAX(s->req_min_rx_int, s->rem_min_tx_int) TO_MS) * s->rem_detect_mult; state = (state < 4) ? state : 0; - tm_format_datetime(tbuf, &config->tf_proto, s->last_state_change); + tm_format_time(tbuf, &config->tf_proto, s->last_state_change); cli_msg(-1020, "%-25I %-10s %-10s %-10s %3u.%03u %3u.%03u", s->addr, ifname, bfd_state_names[state], tbuf, diff --git a/proto/bfd/bfd.h b/proto/bfd/bfd.h index e2e75753..203da437 100644 --- a/proto/bfd/bfd.h +++ b/proto/bfd/bfd.h @@ -144,7 +144,7 @@ struct bfd_session timer2 *hold_timer; /* Timer for session down detection time */ list request_list; /* List of client requests (struct bfd_request) */ - bird_clock_t last_state_change; /* Time of last state change */ + btime last_state_change; /* Time of last state change */ u8 notify_running; /* 1 if notify hooks are running */ u8 rx_csn_known; /* Received crypto sequence number is known */ |