tcpdump mailing list archives
Re: Date format patch
From: Guy Harris <gharris () sonic net>
Date: Sun, 2 Mar 2003 15:37:35 -0800
On Sat, Mar 01, 2003 at 06:41:52PM +0100, Gisle Vanem wrote:
"tcpdump -tttt" prints date in "MM/DD/YYYY" format. This must be rather uncomfortable for non-English users (It was for me).
You misspelled "non-English-speaking or non-North American users". :-) (I.e., DD/MM/YYYY is used in the British Isles as well, as far as I know, and possibly also in Australia and New Zealand.)
So I cooked up a patch to util.c using setlocale() and strftime().
"setlocale()" is per-process, not per-system, so you don't need the stuff to turn it off.
Again, I've no idea how to apply this change to the configure process (testing for setlocale(), locale.h etc). config.h needs these defines to make use of national date-format: HAVE_LOCALE, HAVE_LOCAL_H and HAVE_STRFTIME.
To test for "setlocale()", just add AC_CHECK_FUNCS(setlocale) or add "setlocale" to the (space-separated) argument list in an existing "AC_CHECK_FUNCS()" call. That sets HAVE_SETLOCALE, not HAVE_LOCALE, so use HAVE_SETLOCALE instead of HAVE_LOCALE. To test for "strftime()", use "AC_FUNC_STRFTIME", which checks for it both in the standard C library and the "-lintl" library (which is apparently where it's hidden in some versions of SCO UNIX). It might be a good idea to do that before checking for "setlocal()", if "setlocale()" is in that library as well. To test for "locale.h", add "locale.h" to the argument list in the "AC_CHECK_HEADERS()" call. Note, however, that "%x" prints the date in MM/DD/YY format, not in MM/DD/YYYY format, at least on FreeBSD 3.4 in the default locale, so that changes the output format of "-tttt", at least on that platform. I'll have to look in my ANSI C spec to see whether there's any way to get the national "we've already partied until it's 1999" date format from strftime. - This is the TCPDUMP workers list. It is archived at http://www.tcpdump.org/lists/workers/index.html To unsubscribe use mailto:tcpdump-workers-request () tcpdump org?body=unsubscribe
Current thread:
- Date format patch Gisle Vanem (Mar 01)
- Re: Date format patch Guy Harris (Mar 02)
- Re: Date format patch Gisle Vanem (Mar 02)
- Re: Date format patch Guy Harris (Mar 02)
- Re: Date format patch Bill Fenner (Mar 02)
- Re: Date format patch Gisle Vanem (Mar 03)
- Re: Date format patch Gisle Vanem (Mar 03)
- Re: Date format patch Guy Harris (Mar 04)
- Re: Date format patch Gisle Vanem (Mar 02)
- Re: Date format patch Guy Harris (Mar 02)
- <Possible follow-ups>
- Re: Date format patch Bill Fenner (Mar 01)