diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2019-12-06 14:48:04 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2019-12-06 14:51:13 -0800 |
commit | 1c740444c9224c81b92c4375babc73efe57e1dc9 (patch) | |
tree | 44dfa4035dd0de1bf0c7f6c37c14b5c2d54f4a7a /tests/test-nstrftime.c | |
parent | 0a13f6771d98fd03688a6e202f1e623010e49c6e (diff) | |
download | gnulib-1c740444c9224c81b92c4375babc73efe57e1dc9.tar.gz |
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.
Diffstat (limited to 'tests/test-nstrftime.c')
-rw-r--r-- | tests/test-nstrftime.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/test-nstrftime.c b/tests/test-nstrftime.c index 33d92487c9..7a7f22a76e 100644 --- a/tests/test-nstrftime.c +++ b/tests/test-nstrftime.c @@ -44,6 +44,7 @@ static struct posixtm_test const T[] = { { 1300000000, 0, "%F", "2011-03-13" }, { 0, 10, "%T.%N", "00:00:00.000000010" }, + { 56, 123456789, "%T.%12N", "00:00:56.123456789000" }, { 0, 0, NULL, NULL } }; |