From: René Scharfe Date: Thu, 15 Jun 2017 12:28:22 GMT Subject: Re: [PATCH v2] strbuf: let strbuf_addftime handle %z and %Z itself Message-ID: <02cf275a-8eaa-49b9-7c2a-f98424088e1e@web.de> In-Reply-To: <22850.28477.715057.441985@a1i15.kph.uni-mainz.de> Am 15.06.2017 um 13:27 schrieb Ulrich Mueller: >>>>>> On Thu, 15 Jun 2017, René Scharfe wrote: > >> Callers can opt out for %Z by passing NULL as timezone name. %z is >> always handled internally -- this helps on Windows, where strftime would >> expand it to a timezone name (same as %Z), in violation of POSIX. >> Modifiers are not handled, e.g. %Ez is still passed to strftime. > > POSIX would also allow other things, like a field width: > http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html > > $ date '+%8z' > +0000200 > > (But I believe that's not very useful, and supporting it might require > duplicating much of strftime's code.) Windows doesn't support that (unsurprisingly), but it accepts %#z, which does the same as %z. Let's wait for someone to request support for modifiers and just document the behavior for now. >> Changes from v1: >> - Always handle %z internally. > > Minor nitpick: Shouldn't the comment in strbuf.h be updated to reflect > that change? > >> + * Add the time specified by `tm`, as formatted by `strftime`. `tz_offset` >> + * and `tz_name` are used to expand %z and %Z internally, unless `tz_name` >> + * is NULL. `tz_offset` is in decimal hhmm format, e.g. -600 means six >> + * hours west of Greenwich. Yes, it should. Thanks for paying attention! :) René