[pim] Cosmetic RPF refresh timer display
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 2b418cd..4e6cb89 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -1081,7 +1081,7 @@
{
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 0771960..7d4581d 100644
--- a/pimd/pim_time.c
+++ b/pimd/pim_time.c
@@ -190,6 +190,14 @@
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 379eb6c..2984d9a 100644
--- a/pimd/pim_time.h
+++ b/pimd/pim_time.h
@@ -34,6 +34,7 @@
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 */