gout

A static git page generator
git clone https://git.bracken.jp/gout.git
Log | Files | Refs | README | LICENSE

commit 3da388108d5aeba9763eb3f06d9d820902dfd5bb
parent ae9f630c1303dfcf78e4a95185ecca52e7fb204a
Author: Chris Bracken <chris@bracken.jp>
Date:   Tue, 17 Feb 2026 19:08:58 +0900

format: use gmtime_r instead of gmtime

Reduces reliance on global state, not that it matters much here.

Diffstat:
Msrc/format.c | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/format.c b/src/format.c @@ -13,7 +13,8 @@ void print_time(FILE* out, time_t time, int timezone_offset) { return; } time_t local_time = time + (timezone_offset * 60); - struct tm* time_in = gmtime(&local_time); + struct tm tm_buf; + struct tm* time_in = gmtime_r(&local_time, &tm_buf); if (!time_in) { return; } @@ -36,7 +37,8 @@ void print_time(FILE* out, time_t time, int timezone_offset) { } void print_time_z(FILE* out, time_t time) { - struct tm* time_in = gmtime(&time); + struct tm tm_buf; + struct tm* time_in = gmtime_r(&time, &tm_buf); if (!time_in) { return; } @@ -51,7 +53,8 @@ void print_time_z(FILE* out, time_t time) { /* TODO: add timezone_offset to print_time_short. */ void print_time_short(FILE* out, time_t time) { - struct tm* time_in = gmtime(&time); + struct tm tm_buf; + struct tm* time_in = gmtime_r(&time, &tm_buf); if (!time_in) { return; }