summaryrefslogtreecommitdiff
path: root/sfeed_twtxt.c
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2021-07-19 12:50:44 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2021-07-19 12:50:44 +0200
commit7c78c678069ffd424460cb7a555c8569251c9549 (patch)
tree7e031dc2d915f04e8fb13bf93046f12253bf429d /sfeed_twtxt.c
parent7086670e4335714e1df982bf1058082b7400b653 (diff)
code-style: change gmtime to the reentrant/thread-safe gmtime_r
No functional or performance difference (intended) because these programs are not threaded.
Diffstat (limited to 'sfeed_twtxt.c')
-rw-r--r--sfeed_twtxt.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sfeed_twtxt.c b/sfeed_twtxt.c
index b7d7fc4..231ad1f 100644
--- a/sfeed_twtxt.c
+++ b/sfeed_twtxt.c
@@ -13,7 +13,7 @@ static void
printfeed(FILE *fp, const char *feedname)
{
char *fields[FieldLast];
- struct tm *tm;
+ struct tm parsedtm, *tm;
time_t parsedtime;
ssize_t linelen;
@@ -24,7 +24,7 @@ printfeed(FILE *fp, const char *feedname)
parsedtime = 0;
if (!strtotime(fields[FieldUnixTimestamp], &parsedtime) &&
- (tm = gmtime(&parsedtime))) {
+ (tm = gmtime_r(&parsedtime, &parsedtm))) {
fprintf(stdout, "%04d-%02d-%02dT%02d:%02d:%02dZ\t",
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec);