This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
fdate_sub (char * date, gfc_charlen_type date_len) [...] + fctime (date, date_len,&now);
As convenient as I find that one directly passes the buffer: Doesn't this reduce the number of characters effectively by one?Yes. Is this worth fixing? It would be easy to fix by using malloc to allocate a tmp array of size date_len + 1, and then call f_strcpy to copy the result. As the fix is easy, I'm thinking it should be done, but I have no particularly hard opinion.
AFAICS it will produce a string filled with blanks.Assume 'Sat Aug 19 18:13:14 1995'. That's 24 characters. If one now does: character(len=24) :: str call fdate(str) will this work? I fear that this will produce 'Sat Aug 19 18:13:14 199\0'.
Patch with the above improvements attached. Ok for trunk?
2011-02-24 Janne Blomqvist<jb@gcc.gnu.org>
PR libfortran/47802 * config.h.in: Regenerated. * configure: Regenerated. * configure.ac: Remove checks for ctime and ctime_r, add check for strftime. * intrinsics/date_and_time.c (localtime_r): Move fallback implementation to time_1.h. * intrinsics/time_1.h (localtime_r): Fallback implementation. * intrinsics/ctime.c: Include time_1.h. (ctime_r): Remove fallback implementation. (strctime): New function. (fdate): Use strctime instead of ctime_r. (fdate_sub): Likewise. (ctime): Likewise. (ctime_sub): Likewise
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |