gout

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

commit 645bfa79fc6a2855a0e362cd14cc9a1d1d84df56
parent c989aca485698fb1bd4093170a2913d4351d3ec2
Author: Chris Bracken <chris@bracken.jp>
Date:   Fri, 20 Feb 2026 20:57:18 +0900

format: replace manual abs() with actual abs()

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

diff --git a/src/format.c b/src/format.c @@ -28,8 +28,9 @@ void print_time(FILE* out, time_t time, int timezone_offset) { } char timezone_sign = timezone_offset < 0 ? '-' : '+'; - int timezone_hours = (timezone_offset < 0 ? -1 : 1) * timezone_offset / 60; - int timezone_mins = (timezone_offset < 0 ? -1 : 1) * timezone_offset % 60; + int abs_offset = abs(timezone_offset); + int timezone_hours = abs_offset / 60; + int timezone_mins = abs_offset % 60; char out_str[64]; int r = snprintf(out_str, sizeof(out_str), "%s %c%02d%02d", formatted_time, timezone_sign, timezone_hours, timezone_mins);