[kronolith] kronolith: two post-install snags

Jan Schneider jan at horde.org
Wed Sep 26 09:38:04 UTC 2012


Zitat von cjdl01 <cjdl01 at brokensolstice.com>:

>>> Looks like you have a broken nl_langinfo implementation on your  
>>> system. It returns a strftime format specifier (%r) that isn't  
>>> even supported by your strftime implementation. So it might  
>>> actually be a bug in strftime instead, because %r is supposed to  
>>> be supported on all platforms.
>>
>> Hi Jan,
>>
>> I don't really know anything about C programming and how to use  
>> libraries, and my google searches are just getting me frustrated.   
>> Is there a way to test your hypotheses on my system?  Some quick  
>> and dirty code that can send me down the right path?  -Or- is there  
>> a quick and dirty way to hack the kronolith code to get this  
>> information some other way?  Maybe something in the prefs file?
>>
>> Thank you.
>>
> Hi Jan,
>
> I know you are busy, but I was wondering if you had a minute if you  
> could advise me on this?  I'd like to sort that out, since it does  
> cause confusion for my users.
>
> Thank you!
>
> -Chris

Try this snippet of C code:

#include <langinfo.h>
#include <locale.h>
#include <stdio.h>
#include <time.h>

main()
{
   char *locale, *fmt_C, *fmt_US;
   char result[200];
   time_t now;
   struct tm *t;

   now = time(NULL);
   t = localtime(&now);

   locale = setlocale(LC_TIME, "C");
   fmt_C = nl_langinfo(T_FMT);
   strftime(result, 200, fmt_C, t);
   printf("%s\n%s\n%s\n", locale, fmt_C, result);

   locale = setlocale(LC_TIME, "en_US.UTF-8");
   fmt_US = nl_langinfo(T_FMT);
   strftime(result, 200, fmt_US, t);
   printf("%s\n%s\n%s\n", locale, fmt_US, result);

   return 0;
}

Compiling (gcc file.c) and running (./a.out) should print something like:

C
%H:%M:%S
11:36:30
en_US.UTF-8
%r
11:36:30 AM

-- 
Jan Schneider
The Horde Project
http://www.horde.org/



More information about the kronolith mailing list