mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03:00
Make the %s format (seconds since the epoch) work for a negative
number and when used with a zero-padded field width, e.g. %015s. (my_strftime): Move the `do_number_sign_and_padding' label so that it precedes the code to set `digits'. Otherwise, %0Ns wouldn't work. Before this change, `date -d @-22 +%05s' would print `00-22'. Now, it prints `-0022', as it should.
This commit is contained in:
1 parent
6a18f2232d
commit
cb3da21f16
1 file changed
+1
-1
+1
-1
@@ -909,10 +909,10 @@ my_strftime (CHAR_T *s, size_t maxsize, const CHAR_T *format,
|
||||
}
|
||||
while (u_number_value != 0);
|
||||
|
||||
do_number_sign_and_padding:
|
||||
if (digits < width)
|
||||
digits = width;
|
||||
|
||||
do_number_sign_and_padding:
|
||||
if (negative_number)
|
||||
*--bufp = L_('-');
|
||||
|
||||
|
||||
Reference in new issue
Block a user