[kronolith] kronolith: two post-install snags

cjdl01 cjdl01 at brokensolstice.com
Wed Sep 26 15:44:16 UTC 2012


Quoting cjdl01 <cjdl01 at brokensolstice.com>:

> Quoting Jan Schneider <jan at horde.org>:
>
>> Zitat von cjdl01 <cjdl01 at brokensolstice.com>:
>>
>>> Quoting Jan Schneider <jan at horde.org>:
>>>
>>>> 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/
>>>
>>> Thank you.  I learned something new.
>>>
>>> The output looks good:
>>>
>>> C
>>> %H:%M:%S
>>> 09:47:45
>>> en_US.UTF-8
>>> %r
>>> 09:47:45 AM
>>>
>>> So the problem must lie elsewhere, eh?
>>>
>>> -Chris
>>
>> Well, then there is probably something wrong with your PHP. This is  
>> the PHP equivalent of the C script:
>>
>> $t = time();
>>
>> $locale = setlocale(LC_TIME, "C");
>> $fmt_C = nl_langinfo(T_FMT);
>> $result = strftime($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);
>> $result = strftime($fmt_US, $t);
>> printf("%s\n%s\n%s\n", $locale, $fmt_US, $result);
>>
>> The output should be the same.
>> -- 
>> Jan Schneider
>
>
> Hi Jan.  Here is the output from the php script:
>
> C
> %H:%M:%S
> 11:14:23
> en_US.UTF-8
> %r
> 11:14:23 AM

I should probably add that it yields this output both on the command  
line and within the Horde context (using the php shell included in  
horde).

Thanks!

-Chris


More information about the kronolith mailing list