diff options
author | Everton Marques <everton.marques@gmail.com> | 2010-03-17 10:34:24 -0300 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2015-02-04 06:07:53 +0100 |
commit | ff752d431675caed78e7b460b2d9a4845e5b6a73 (patch) | |
tree | 1f1b8a238f202c372007d9f19141ce010515a550 | |
parent | 0ef36d82d87094b32f71be47a73144459f057db9 (diff) | |
download | quagga-ff752d431675caed78e7b460b2d9a4845e5b6a73.tar.bz2 quagga-ff752d431675caed78e7b460b2d9a4845e5b6a73.tar.xz |
[pim] Cosmetic RPF refresh timer display
-rw-r--r-- | pimd/pim_cmd.c | 2 | ||||
-rw-r--r-- | pimd/pim_time.c | 8 | ||||
-rw-r--r-- | pimd/pim_time.h | 1 |
3 files changed, 10 insertions, 1 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 2b418cd4..4e6cb89b 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -1081,7 +1081,7 @@ static void show_rpf_refresh_stats(struct vty *vty, time_t now) { char refresh_uptime[10]; - pim_time_uptime(refresh_uptime, sizeof(refresh_uptime), now - qpim_rpf_cache_refresh_last); + pim_time_uptime_begin(refresh_uptime, sizeof(refresh_uptime), now, qpim_rpf_cache_refresh_last); vty_out(vty, "RPF Cache Refresh Delay: %ld msecs%s" diff --git a/pimd/pim_time.c b/pimd/pim_time.c index 07719608..7d4581d9 100644 --- a/pimd/pim_time.c +++ b/pimd/pim_time.c @@ -190,6 +190,14 @@ void pim_time_uptime(char *buf, int buf_size, int64_t uptime_sec) pim_time_hhmmss(buf, buf_size, uptime_sec); } +void pim_time_uptime_begin(char *buf, int buf_size, int64_t now, int64_t begin) +{ + if (begin > 0) + pim_time_uptime(buf, buf_size, now - begin); + else + snprintf(buf, buf_size, "--:--:--"); +} + long pim_time_timer_remain_msec(struct thread *t_timer) { /* FIXME: Actually fetch msec resolution from thread */ diff --git a/pimd/pim_time.h b/pimd/pim_time.h index 379eb6cf..2984d9a8 100644 --- a/pimd/pim_time.h +++ b/pimd/pim_time.h @@ -34,6 +34,7 @@ int pim_time_mmss(char *buf, int buf_size, long sec); void pim_time_timer_to_mmss(char *buf, int buf_size, struct thread *t); void pim_time_timer_to_hhmmss(char *buf, int buf_size, struct thread *t); void pim_time_uptime(char *buf, int buf_size, int64_t uptime_sec); +void pim_time_uptime_begin(char *buf, int buf_size, int64_t now, int64_t begin); long pim_time_timer_remain_msec(struct thread *t_timer); #endif /* PIM_TIME_H */ |