http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47802
--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-02-22 09:26:50 UTC --- Well, if you don't want to localize, you can as well do it yourself, call localtime_r and then simple: char result[26]; int n = snprintf (result, sizeof (result), "%3.3s %3.3s%3d %.2d:%.2d:%.2d %d\n", "SunMonTueWedThuFriSat" + tm->tm_wday * 3, "JanFebMarAprMayJunJulAugSepOctNovDec" + tm->tm_mon * 3, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, 1900 + tm->tm_year); if ((size_t) n >= sizeof (result)) result[0] = '\0'; /* The result didn't fit into 26 bytes. */ (or use larger buffer, perhaps you can just snprintf into the caller provided buffer instead and depending on return value from snprintf just memset to ' ' the rest of the string if there are still any bytes left in it.