• René Scharfe's avatar
    strbuf: let strbuf_addftime handle %z and %Z itself · c3fbf81a
    René Scharfe authored
    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
    Helped-by: Ulrich Müller's avatarUlrich Mueller <ulm@gentoo.org>
    Helped-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarRene Scharfe <l.s.r@web.de>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
strbuf.c 19.9 KB