This one time, at band camp, Sven Luther said:
>
> The code yielding to this was of the kind of :
>
> struct tm tm;
> time_t t;
> t = time(NULL);
> localtime (&t, &tm);
>
> This is in a fr_FR.utf8 locale, on a powerpc box. The same code on an x86 box
> just segfaults without error message.
That doesn't even compile here:
#include <time.h>
#include <stdlib.h>
int main (void) {
struct tm tm;
time_t t;
t = time(NULL);
localtime (&t, &tm);
exit(0);
}
steve@gashuffer:~$ gcc -Wall t.c
t.c: In function ‘main’:
t.c:8: error: too many arguments to function ‘localtime’
steve@gashuffer:~$
This code works fine, though:
#include <time.h>
#include <stdlib.h>
int main (void) {
struct tm *tm;
time_t t;
t = time(NULL);
tm = localtime (&t);
exit(0);
}
steve@gashuffer:~$ gcc -Wall t.c
steve@gashuffer:~$ LC_ALL=fr_FR.utf8 ./a.out
steve@gashuffer:~$
--
-----------------------------------------------------------------
| ,''`. Stephen Gran |
| : :' : sgran@debian.org |
| `. `' Debian user, admin, and developer |
| `- http://www.debian.org |
-----------------------------------------------------------------
Attachment:
signature.asc
Description: Digital signature