Re: cvs commit: src/bin/date date.c

看板DFBSD_commit作者時間21年前 (2005/03/28 14:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串5/6 (看更多)
--liOOAslEiF7prFVr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, Mar 26, 2005 at 03:25:44PM +0100, Joerg Sonnenberger wrote: > > > Log: > > > Instead of using the non-standard conforming %+ format string, > > > use nl_langinfo to query the default format string. > > > > > > Revision Changes Path > > > 1.9 +2 -1 src/bin/date/date.c > > > > > > > > > http://www.dragonflybsd.org/cvsweb/src/bin/date/date.c.diff?r1=1.8&r2=1.9&f=u > > > > this commit totaly destroy any imformation about local time zone. > > e.g. > > > > apocalypse# date > > Sat Mar 26 03:49:13 2005 > > apocalypse# ./date.old > > Sat Mar 26 03:49:14 CET 2005 > > > > is there are any plans to make it work again? (mayby after final CITRUS > > integration?) > > This is _not_ a bug in date, I think the locale is wrong here. But I have > to check this. As far as I know, the D_T_FMT does not contain timezone(%Z) string on other platforms as well. This is on a RedHat 9 box: $ LC_TIME= locale -c d_t_fmt LC_TIME %a %b %e %H:%M:%S %Y $ LC_TIME= locale -c date_fmt LC_TIME %a %b %e %H:%M:%S %Z %Y and probably same goes for Solaris according to Google search: http://64.233.179.104/search?q=cache:MPhgqK9PvP4J:docsun.cites.uiuc.edu/sun_docs/C/solaris_9/SUNWaman/hman5/locale.5.html+nl_langinfo+DATE_FMT Looking at files under /usr/src/share/timefmt, we do have date_fmt and with %Z in, but we have no DATE_FMT defined in langinfo.h. In fact, strftime("%+") is the only way to use the date_fmt. Attached patch enables it and make date use it, but I don't know why it's not in FreeBSD until now, so there may be something wrong with it. --liOOAslEiF7prFVr Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="locale-date_fmt.diff" Index: bin/date/date.c =================================================================== RCS file: /home/source/dragonfly/cvs/src/bin/date/date.c,v retrieving revision 1.9 diff -u -r1.9 date.c --- bin/date/date.c 14 Mar 2005 23:55:41 -0000 1.9 +++ bin/date/date.c 28 Mar 2005 05:28:16 -0000 @@ -138,7 +138,7 @@ if (!rflag && time(&tval) == -1) err(1, "time"); - format = nl_langinfo(D_T_FMT); + format = nl_langinfo(DATE_FMT); /* allow the operands in any order */ if (*argv && **argv == '+') { Index: include/langinfo.h =================================================================== RCS file: /home/source/dragonfly/cvs/src/include/langinfo.h,v retrieving revision 1.3 diff -u -r1.3 langinfo.h --- include/langinfo.h 14 Nov 2003 01:01:43 -0000 1.3 +++ include/langinfo.h 28 Mar 2005 05:16:28 -0000 @@ -105,6 +105,9 @@ #define D_MD_ORDER 57 /* month/day order (local extension) */ +#define DATE_FMT 58 /* national date/time representation + with timezone */ + __BEGIN_DECLS char *nl_langinfo (nl_item); __END_DECLS Index: lib/libc/locale/nl_langinfo.c =================================================================== RCS file: /home/source/dragonfly/cvs/src/lib/libc/locale/nl_langinfo.c,v retrieving revision 1.2 diff -u -r1.2 nl_langinfo.c --- lib/libc/locale/nl_langinfo.c 17 Jun 2003 04:26:44 -0000 1.2 +++ lib/libc/locale/nl_langinfo.c 28 Mar 2005 05:11:22 -0000 @@ -86,6 +86,9 @@ ret = "US-ASCII"; } break; + case DATE_FMT: + ret = (char *) __get_current_time_locale()->date_fmt; + break; case D_T_FMT: ret = (char *) __get_current_time_locale()->c_fmt; break; --liOOAslEiF7prFVr--
文章代碼(AID): #12Hvse00 (DFBSD_commit)
文章代碼(AID): #12Hvse00 (DFBSD_commit)