aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/intrinsics
diff options
context:
space:
mode:
authorJanne Blomqvist <jb@gcc.gnu.org>2011-03-04 19:52:10 +0200
committerJanne Blomqvist <jb@gcc.gnu.org>2011-03-04 19:52:10 +0200
commit7a9d7a4f865490d0972a07dc4d8ae2de6b2c5a27 (patch)
tree386f797f246906d22c61b0b7efb07cdcff08a569 /libgfortran/intrinsics
parentd9d114ecd0a494f9fabee9eada8ca2814eb10e68 (diff)
downloadgcc-7a9d7a4f865490d0972a07dc4d8ae2de6b2c5a27.zip
gcc-7a9d7a4f865490d0972a07dc4d8ae2de6b2c5a27.tar.gz
gcc-7a9d7a4f865490d0972a07dc4d8ae2de6b2c5a27.tar.bz2
PR 47802 Hack to work around draft POSIX localtime_r
From-SVN: r170680
Diffstat (limited to 'libgfortran/intrinsics')
-rw-r--r--libgfortran/intrinsics/ctime.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libgfortran/intrinsics/ctime.c b/libgfortran/intrinsics/ctime.c
index 7eb10f5f..29a0e6f 100644
--- a/libgfortran/intrinsics/ctime.c
+++ b/libgfortran/intrinsics/ctime.c
@@ -39,9 +39,13 @@ static size_t
strctime (char *s, size_t max, const time_t *timep)
{
#ifdef HAVE_STRFTIME
- struct tm res;
- struct tm *ltm = localtime_r (timep, &res);
- return strftime (s, max, "%c", ltm);
+ struct tm ltm;
+ /* Note: We can't use the return value of localtime_r, as some
+ targets provide localtime_r based on a draft of the POSIX
+ standard where the return type is int rather than the
+ standardized struct tm*. */
+ localtime_r (timep, &ltm);
+ return strftime (s, max, "%c", &ltm);
#else
return 0;
#endif