Skip to content

Commit

Permalink
Use localtime_r
Browse files Browse the repository at this point in the history
  • Loading branch information
arr2036 committed Sep 19, 2019
1 parent e860fa0 commit bda7fc2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/bin/radsniff.c
Expand Up @@ -192,13 +192,14 @@ static void rs_time_print(char *out, size_t len, struct timeval const *t)
size_t ret;
struct timeval now;
uint32_t usec;
struct tm result;

if (!t) {
now = fr_time_to_timeval(fr_time());
t = &now;
}

ret = strftime(out, len, "%Y-%m-%d %H:%M:%S", localtime(&t->tv_sec));
ret = strftime(out, len, "%Y-%m-%d %H:%M:%S", localtime_r(&t->tv_sec, &result));
if (ret >= len) {
return;
}
Expand Down

0 comments on commit bda7fc2

Please sign in to comment.