diff options
author | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-02-24 21:51:39 +0000 |
---|---|---|
committer | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-02-24 21:51:39 +0000 |
commit | bacb1fe37333fd4e32310a9bd57e20d624e2f994 (patch) | |
tree | 2a641f6a7dbe42592aa100fae7f9736fcb97a7bd /libgfortran/intrinsics/time_1.h | |
parent | 8fe62af32a4fb8554ed545038513384389f2011b (diff) | |
download | gcc-bacb1fe37333fd4e32310a9bd57e20d624e2f994.tar.gz |
PR 47802 Use strftime for CTIME and FDATE intrinsics
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170478 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/intrinsics/time_1.h')
-rw-r--r-- | libgfortran/intrinsics/time_1.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libgfortran/intrinsics/time_1.h b/libgfortran/intrinsics/time_1.h index 073595a1442..12d79ebc12f 100644 --- a/libgfortran/intrinsics/time_1.h +++ b/libgfortran/intrinsics/time_1.h @@ -84,6 +84,26 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #endif /* !HAVE_GETRUSAGE || !HAVE_SYS_RESOURCE_H */ +/* If the re-entrant version of localtime is not available, provide a + fallback implementation. On some targets where the _r version is + not available, localtime uses thread-local storage so it's + threadsafe. */ + +#ifndef HAVE_LOCALTIME_R +/* If _POSIX is defined localtime_r gets defined by mingw-w64 headers. */ +#ifdef localtime_r +#undef localtime_r +#endif + +static inline struct tm * +localtime_r (const time_t * timep, struct tm * result) +{ + *result = *localtime (timep); + return result; +} +#endif + + #if defined (__GNUC__) && (__GNUC__ >= 3) # define ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__)) #else |