fix strftime %y for negative tm_year
authorSzabolcs Nagy <nsz@port70.net>
Tue, 4 Oct 2016 17:14:57 +0000 (17:14 +0000)
committerRich Felker <dalias@aerifal.cx>
Thu, 6 Oct 2016 22:41:45 +0000 (18:41 -0400)
src/time/strftime.c

index f1ccc4dd5e848c734767f34f206daf9b173675df..e103e02b72044054f13bcbae7a16e5cb5e2781b1 100644 (file)
@@ -167,6 +167,7 @@ const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *
                goto nl_strftime;
        case 'y':
                val = tm->tm_year % 100;
+               if (val<0) val += 100;
                goto number;
        case 'Y':
                val = tm->tm_year + 1900LL;