This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/47802] [4.6 Regression] libgfortran/intrinsics/ctime.c:75:3: error: too few arguments to function 'ctime_r'
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 22 Feb 2011 09:26:55 +0000
- Subject: [Bug libfortran/47802] [4.6 Regression] libgfortran/intrinsics/ctime.c:75:3: error: too few arguments to function 'ctime_r'
- Auto-submitted: auto-generated
- References: <bug-47802-4@http.gcc.gnu.org/bugzilla/>
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.