diff options
author | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-03-04 17:52:10 +0000 |
---|---|---|
committer | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-03-04 17:52:10 +0000 |
commit | 55d7f3de15fc8b4b1bce5f23b962953a9d23211c (patch) | |
tree | 386f797f246906d22c61b0b7efb07cdcff08a569 /libgfortran | |
parent | 4be95726a82cb9ca46827d373c3e010ddae137c9 (diff) | |
download | gcc-55d7f3de15fc8b4b1bce5f23b962953a9d23211c.tar.gz |
PR 47802 Hack to work around draft POSIX localtime_r
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170680 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 6 | ||||
-rw-r--r-- | libgfortran/intrinsics/ctime.c | 10 |
2 files changed, 13 insertions, 3 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index a628fdd8ea1..73e2bb2ad13 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2011-03-04 Janne Blomqvist <jb@gcc.gnu.org> + + PR libfortran/47802 + * intrinsics/ctime.c (strctime): Don't use return value of + localtime_r. + 2011-02-28 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/47567 diff --git a/libgfortran/intrinsics/ctime.c b/libgfortran/intrinsics/ctime.c index 7eb10f5fa2c..29a0e6f00f2 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, <m); + return strftime (s, max, "%c", <m); #else return 0; #endif |