scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 080c51bdf15fd5a2466189742b922fcf0a7e3a5e
parent baf9395306241e466d710d92615c226530ac018c
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date:   Tue, 14 Apr 2026 18:29:33 +0200

libc/time: Fix %z specifier in strftime()

A wrong pointer calculation was truncating the string generated
returning the correct size but a wrong string.

Diffstat:
Msrc/libc/time/strftime.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/libc/time/strftime.c b/src/libc/time/strftime.c @@ -150,14 +150,14 @@ timezone(char *s, size_t siz, const struct tm * restrict tm) long off = tm->tm_gmtoff; if (off >= 0) { - *s++ = '+'; + *s = '+'; } else { - *s++ = '-'; + *s = '-'; off = -off; } n = 1; - n += dval(s, siz-n, 2, '0', off / 3600); + n += dval(s + n, siz-n, 2, '0', off / 3600); n += dval(s + n, siz-n, 2, '0', (off % 3600) / 60); return n;