diff options
author | Werner Koch <[email protected]> | 1999-04-28 11:06:52 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 1999-04-28 11:06:52 +0000 |
commit | dbb6174399c0fa48123359fc50e84dd11e545e71 (patch) | |
tree | 834338fae5acde97f05e0796a3c92f4da5dfa5e7 /util/miscutil.c | |
parent | See ChangeLog: Mon Apr 26 17:48:15 CEST 1999 Werner Koch (diff) | |
download | gnupg-dbb6174399c0fa48123359fc50e84dd11e545e71.tar.gz gnupg-dbb6174399c0fa48123359fc50e84dd11e545e71.zip |
See ChangeLog: Wed Apr 28 13:03:03 CEST 1999 Werner Koch
Diffstat (limited to '')
-rw-r--r-- | util/miscutil.c | 25 |
1 files changed, 19 insertions, 6 deletions
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 <string.h> #include <time.h> #include <ctype.h> +#ifdef HAVE_LANGINFO_H + #include <langinfo.h> +#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) ); |