diff options
author | Werner Koch <wk@gnupg.org> | 2010-10-04 23:08:34 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2010-10-04 23:08:34 +0200 |
commit | adfa280d6f1e99c0f5d76b8698929e734ad0cf8f (patch) | |
tree | b248afa5a73160754ff490067ce834831af02238 /common/gettime.c | |
parent | Exporting secret keys via gpg-agent is now basically supported. (diff) | |
download | gnupg2-adfa280d6f1e99c0f5d76b8698929e734ad0cf8f.tar.xz gnupg2-adfa280d6f1e99c0f5d76b8698929e734ad0cf8f.zip |
[w32ce] Do not print the faulty timezone info
Switch FAQ sources to org-mode
Diffstat (limited to 'common/gettime.c')
-rw-r--r-- | common/gettime.c | 57 |
1 files changed, 31 insertions, 26 deletions
diff --git a/common/gettime.c b/common/gettime.c index 658433d18..e54c3a628 100644 --- a/common/gettime.c +++ b/common/gettime.c @@ -330,41 +330,46 @@ isotimestamp (u32 stamp) * Note: this function returns local time */ const char * -asctimestamp( u32 stamp ) +asctimestamp (u32 stamp) { - static char buffer[50]; + static char buffer[50]; #if defined (HAVE_STRFTIME) && defined (HAVE_NL_LANGINFO) - static char fmt[50]; + static char fmt[50]; #endif - struct tm *tp; - time_t atime = stamp; + struct tm *tp; + time_t atime = stamp; - if (atime < 0) { - strcpy (buffer, "????" "-??" "-??"); - return buffer; + if (atime < 0) + { + strcpy (buffer, "????" "-??" "-??"); + return buffer; } - tp = localtime( &atime ); + tp = localtime( &atime ); #ifdef HAVE_STRFTIME -#if defined(HAVE_NL_LANGINFO) - mem2str( fmt, nl_langinfo(D_T_FMT), DIM(fmt)-3 ); - if( strstr( fmt, "%Z" ) == NULL ) - strcat( fmt, " %Z"); - /* NOTE: gcc -Wformat-noliteral will complain here. I have - found no way to suppress this warning .*/ - 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; +# if defined(HAVE_NL_LANGINFO) + mem2str( fmt, nl_langinfo(D_T_FMT), DIM(fmt)-3 ); + if (!strstr( fmt, "%Z" )) + strcat( fmt, " %Z"); + /* NOTE: gcc -Wformat-noliteral will complain here. I have found no + way to suppress this warning. */ + strftime (buffer, DIM(buffer)-1, fmt, tp); +# elif defined(HAVE_W32CE_SYSTEM) + /* tzset is not available but %Z nevertheless prints a default + nonsense timezone ("WILDABBR"). Thus we don't print the time + zone at all. */ + strftime (buffer, DIM(buffer)-1, "%c", 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) ); + mem2str( buffer, asctime(tp), DIM(buffer) ); #endif - return buffer; + return buffer; } |