summaryrefslogtreecommitdiffstats
path: root/isisd
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2020-03-05 17:42:12 +0100
committerMark Stapp <mjs@voltanet.io>2020-03-05 19:26:16 +0100
commita2700b5071e53a78be2f8098765dcca58c2b6ee5 (patch)
treee32654991ac297bd3917401ae429ee54da385e5e /isisd
parentMerge pull request #5890 from mjstapp/zapi_allow_label_num (diff)
downloadfrr-a2700b5071e53a78be2f8098765dcca58c2b6ee5.tar.xz
frr-a2700b5071e53a78be2f8098765dcca58c2b6ee5.zip
*: use gmtime_r, localtime_r exclusively
Stop using gmtime() or localtime() everywhere. Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'isisd')
-rw-r--r--isisd/isis_misc.c17
-rw-r--r--isisd/isis_vty_fabricd.c18
2 files changed, 19 insertions, 16 deletions
diff --git a/isisd/isis_misc.c b/isisd/isis_misc.c
index a7f491e87..5fa33f550 100644
--- a/isisd/isis_misc.c
+++ b/isisd/isis_misc.c
@@ -562,19 +562,20 @@ void vty_multiline(struct vty *vty, const char *prefix, const char *format, ...)
void vty_out_timestr(struct vty *vty, time_t uptime)
{
- struct tm *tm;
+ struct tm tm;
time_t difftime = time(NULL);
difftime -= uptime;
- tm = gmtime(&difftime);
+
+ gmtime_r(&difftime, &tm);
if (difftime < ONE_DAY_SECOND)
- vty_out(vty, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min,
- tm->tm_sec);
+ vty_out(vty, "%02d:%02d:%02d", tm.tm_hour, tm.tm_min,
+ tm.tm_sec);
else if (difftime < ONE_WEEK_SECOND)
- vty_out(vty, "%dd%02dh%02dm", tm->tm_yday, tm->tm_hour,
- tm->tm_min);
+ vty_out(vty, "%dd%02dh%02dm", tm.tm_yday, tm.tm_hour,
+ tm.tm_min);
else
- vty_out(vty, "%02dw%dd%02dh", tm->tm_yday / 7,
- tm->tm_yday - ((tm->tm_yday / 7) * 7), tm->tm_hour);
+ vty_out(vty, "%02dw%dd%02dh", tm.tm_yday / 7,
+ tm.tm_yday - ((tm.tm_yday / 7) * 7), tm.tm_hour);
vty_out(vty, " ago");
}
diff --git a/isisd/isis_vty_fabricd.c b/isisd/isis_vty_fabricd.c
index 24e5c5194..88f7337a9 100644
--- a/isisd/isis_vty_fabricd.c
+++ b/isisd/isis_vty_fabricd.c
@@ -129,18 +129,20 @@ static void lsp_print_flooding(struct vty *vty, struct isis_lsp *lsp)
lsp->flooding_interface : "(null)");
time_t uptime = time(NULL) - lsp->flooding_time;
- struct tm *tm = gmtime(&uptime);
+ struct tm tm;
+
+ gmtime_r(&uptime, &tm);
if (uptime < ONE_DAY_SECOND)
- vty_out(vty, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min,
- tm->tm_sec);
+ vty_out(vty, "%02d:%02d:%02d", tm.tm_hour, tm.tm_min,
+ tm.tm_sec);
else if (uptime < ONE_WEEK_SECOND)
- vty_out(vty, "%dd%02dh%02dm", tm->tm_yday, tm->tm_hour,
- tm->tm_min);
+ vty_out(vty, "%dd%02dh%02dm", tm.tm_yday, tm.tm_hour,
+ tm.tm_min);
else
- vty_out(vty, "%02dw%dd%02dh", tm->tm_yday / 7,
- tm->tm_yday - ((tm->tm_yday / 7) * 7),
- tm->tm_hour);
+ vty_out(vty, "%02dw%dd%02dh", tm.tm_yday / 7,
+ tm.tm_yday - ((tm.tm_yday / 7) * 7),
+ tm.tm_hour);
vty_out(vty, " ago)\n");
if (lsp->flooding_circuit_scoped) {