]> git.ipfire.org Git - thirdparty/git.git/commit - strbuf.c
strbuf: let strbuf_addftime handle %z and %Z itself
authorRené Scharfe <l.s.r@web.de>
Thu, 15 Jun 2017 12:29:53 +0000 (14:29 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 15 Jun 2017 21:34:37 +0000 (14:34 -0700)
commitc3fbf81a8534cf88ff948d12004eb94929ec1174
tree38baba13d581006b0923be997c27f29d4b4a40fe
parentb06d3643105c8758ed019125a4399cb7efdcce2c
strbuf: let strbuf_addftime handle %z and %Z itself

There is no portable way to pass timezone information to strftime.  Add
parameters for timezone offset and name to strbuf_addftime and let it
handle the timezone-related format specifiers %z and %Z internally.

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.

Use an empty string as timezone name in show_date (the only current
caller) for now because we only have the timezone offset in non-local
mode.  POSIX allows %Z to resolve to an empty string in case of missing
information.

Helped-by: Ulrich Mueller <ulm@gentoo.org>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/rev-list-options.txt
date.c
strbuf.c
strbuf.h
t/t0006-date.sh