From dbb6174399c0fa48123359fc50e84dd11e545e71 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 28 Apr 1999 11:06:52 +0000 Subject: See ChangeLog: Wed Apr 28 13:03:03 CEST 1999 Werner Koch --- util/ChangeLog | 4 ++++ util/miscutil.c | 25 +++++++++++++++++++------ 2 files changed, 23 insertions(+), 6 deletions(-) (limited to 'util') diff --git a/util/ChangeLog b/util/ChangeLog index 6dac03492..33b500b02 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -1,3 +1,7 @@ +Wed Apr 28 13:03:03 CEST 1999 Werner Koch + + * miscutil.c (asctimestamp): Use nl_langinfo (Gaël Quéri). + Sun Apr 18 10:11:28 CEST 1999 Werner Koch * argparse.c (store_alias): Disabled becuase it is not used. diff --git a/util/miscutil.c b/util/miscutil.c index 5e1844893..a1d480fa4 100644 --- a/util/miscutil.c +++ b/util/miscutil.c @@ -1,5 +1,5 @@ /* miscutil.c - miscellaneous utilities - * Copyright (C) 1998 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -23,6 +23,9 @@ #include #include #include +#ifdef HAVE_LANGINFO_H + #include +#endif #include "types.h" #include "util.h" #include "i18n.h" @@ -91,16 +94,26 @@ const char * asctimestamp( u32 stamp ) { static char buffer[50]; + #if defined (HAVE_STRFTIME) && defined (HAVE_NL_LANGINFO) + static char fmt[50]; + #endif struct tm *tp; time_t atime = stamp; tp = localtime( &atime ); #ifdef HAVE_STRFTIME - /* fixme: we should check whether the locale apppends a " %Z" - * These locales from glibc don't put the " %Z": - * fi_FI hr_HR ja_JP lt_LT lv_LV POSIX ru_RU ru_SU sv_FI sv_SE zh_CN - */ - strftime( buffer, DIM(buffer)-1, "%c %Z", tp ); + #if defined(HAVE_NL_LANGINFO) + mem2str( fmt, nl_langinfo(D_T_FMT), DIM(fmt) ); + if( strstr( fmt, "%Z" ) == NULL ) + strcat( fmt, " %Z"); + strftime( buffer, DIM(buffer)-1, fmt, tp ); + #else + /* fixme: we should check whether the locale appends a " %Z" + * These locales from glibc don't put the " %Z": + * fi_FI hr_HR ja_JP lt_LT lv_LV POSIX ru_RU ru_SU sv_FI sv_SE zh_CN + */ + strftime( buffer, DIM(buffer)-1, "%c %Z", tp ); + #endif buffer[DIM(buffer)-1] = 0; #else mem2str( buffer, asctime(tp), DIM(buffer) ); -- cgit v1.2.3