bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: strftime.c fix obscure %s formatting bug


From: Jim Meyering
Subject: FYI: strftime.c fix obscure %s formatting bug
Date: Fri, 19 Aug 2005 11:24:30 +0200

FYI, I've just checked in this change:

2005-08-17  Jim Meyering  <address@hidden>

        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.

        * strftime.c (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.

Index: strftime.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/strftime.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -p -u -r1.84 -r1.85
--- strftime.c  4 Jul 2005 04:40:46 -0000       1.84
+++ strftime.c  19 Aug 2005 09:21:57 -0000      1.85
@@ -909,10 +909,10 @@ my_strftime (CHAR_T *s, size_t maxsize,
            }
          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_('-');
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]