]> Savannah Git Hosting - gnulib.git/commit
nstrftime: better width support for %N, %z
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 6 Dec 2019 22:48:04 +0000 (14:48 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 6 Dec 2019 22:51:13 +0000 (14:51 -0800)
commit1c740444c9224c81b92c4375babc73efe57e1dc9
tree44dfa4035dd0de1bf0c7f6c37c14b5c2d54f4a7a
parent0a13f6771d98fd03688a6e202f1e623010e49c6e
nstrftime: better width support for %N, %z

* lib/nstrftime.c (width_add, width_add1, width_cpy):
New macros, which generalize ‘add’, ‘add1’, ‘cpy’ by adding
a new WIDTH parameter.
(add, add1, cpy): Use these macros.
(width_add): Do not treat digits == 0 as a special case,
do not pad if padding is ‘-’, and do not use a negative width.
(__strftime_internal): Redo formatting of nanoseconds and numeric
timezones to avoid buffer misuse in unusual cases, and so that
widths make more sense.  Add support for widths greater than 9 to
the %N format; they are zero filled on the right.
* tests/test-nstrftime.c (posixtm_test): Add a %12N test.
ChangeLog
lib/nstrftime.c
tests/test-nstrftime.c