summaryrefslogtreecommitdiffstats
path: root/isisd/isis_misc.c
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/isis_misc.c
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/isis_misc.c')
-rw-r--r--isisd/isis_misc.c17
1 files changed, 9 insertions, 8 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");
}