X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f Date: Tue, 28 Oct 2003 11:48:46 +0300 (MSK) From: "Alexander Aganichev" Sender: aaganichev AT yandex DOT ru Message-Id: <3F9E2D6E.000001.26938@pantene.yandex.ru> MIME-Version: 1.0 X-Mailer: Yamail [ http://yandex.ru ] To: djgpp-workers AT delorie DOT com Subject: "X" and "x" for strftime() X-source-ip: 208.248.82.254 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com This change prepares strftime() for locale support: diff -rup djgpp.orig/src/libc/ansi/time/strftime.c djgpp/src/libc/ansi/time/strftime.c --- djgpp.orig/src/libc/ansi/time/strftime.c 2001-12-04 05:08:44.000000000 +0000 +++ djgpp/src/libc/ansi/time/strftime.c 2003-10-28 09:40:22.000000000 +0000 @@ -23,6 +23,8 @@ static const char *Bfmt[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", }; +char __dj_date_format[10] = "%m/%d/%y"; +char __dj_time_format[16] = "%H:%M:%S"; static size_t gsize; static char *pt; @@ -177,7 +179,6 @@ _fmt(const char *format, const struct tm return 0; continue; case 'T': - case 'X': if (!_fmt("%H:%M:%S", t, upcase)) return 0; continue; @@ -204,8 +205,12 @@ _fmt(const char *format, const struct tm if (!_conv(t->tm_wday, 1, pad)) return 0; continue; + case 'X': + if (!_fmt(__dj_time_format, t, upcase)) + return 0; + continue; case 'x': - if (!_fmt("%m/%d/%y", t, upcase)) + if (!_fmt(__dj_date_format, t, upcase)) return 0; continue; case 'y': diff -rup djgpp.orig/src/libc/ansi/time/strftime.txh djgpp/src/libc/ansi/time/strftime.txh --- djgpp.orig/src/libc/ansi/time/strftime.txh 2003-01-30 05:08:42.000000000 +0000 +++ djgpp/src/libc/ansi/time/strftime.txh 2003-10-28 11:42:20.000000000 +0000 @@ -108,7 +108,6 @@ Short for @code{%I:%M:%S %p} (@code{03:3 The seconds, zero padded to two characters (@code{35}) @item %T -@itemx %X Short for @code{%H:%M:%S} (@code{15:30:35}) @@ -136,7 +135,11 @@ The day of the week (0-6) (@code{5}) @item %x -Short for @code{%m/%d/%y} (@code{10/01/93}) +Date representated according to the current locale. + +@item %X + +Time representated according to the current locale. @item %y -- Alexander Aganichev url: http://aaganichev.narod.ru e-mail: aaganichev AT yandex DOT ru gsm: +7-095-786-1339