summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdtime/localtime.c
diff options
context:
space:
mode:
authordt <dt@FreeBSD.org>1999-01-04 20:45:20 +0000
committerdt <dt@FreeBSD.org>1999-01-04 20:45:20 +0000
commitc09e434e50a2e69664cce10032e5455105da675c (patch)
tree1583febd14399ef2ef8e7a3a0bbff06da83f4b41 /lib/libc/stdtime/localtime.c
parent7593ef4cbdd685a9195c1ebf53977dfabc35fa70 (diff)
downloadFreeBSD-src-c09e434e50a2e69664cce10032e5455105da675c.zip
FreeBSD-src-c09e434e50a2e69664cce10032e5455105da675c.tar.gz
Make ctime_r, asctime_r, gmtime_r, and localtime_r available in libc.
Diffstat (limited to 'lib/libc/stdtime/localtime.c')
-rw-r--r--lib/libc/stdtime/localtime.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/libc/stdtime/localtime.c b/lib/libc/stdtime/localtime.c
index ad227cf..9e130bd 100644
--- a/lib/libc/stdtime/localtime.c
+++ b/lib/libc/stdtime/localtime.c
@@ -1082,19 +1082,21 @@ struct tm * const tmp;
#endif /* defined TM_ZONE */
}
-#ifdef _THREAD_SAFE
struct tm *
localtime_r(timep, p_tm)
const time_t * const timep;
struct tm *p_tm;
{
+#ifdef _THREAD_SAFE
pthread_mutex_lock(&lcl_mutex);
+#endif
tzset();
localsub(timep, 0L, p_tm);
+#ifdef _THREAD_SAFE
pthread_mutex_unlock(&lcl_mutex);
+#endif
return(p_tm);
}
-#endif
struct tm *
localtime(timep)
@@ -1214,14 +1216,12 @@ const time_t * const timep;
#endif
}
-#ifdef _THREAD_SAFE
struct tm *
gmtime_r(const time_t * timep, struct tm * tm)
{
gmtsub(timep, 0L, tm);
return(tm);
}
-#endif
#ifdef STD_INSPIRED
@@ -1350,7 +1350,6 @@ const time_t * const timep;
return asctime(localtime(timep));
}
-#ifdef _THREAD_SAFE
char *
ctime_r(timep, buf)
const time_t * const timep;
@@ -1359,7 +1358,6 @@ char *buf;
struct tm tm;
return asctime_r(localtime_r(timep, &tm), buf);
}
-#endif
/*
** Adapted from code provided by Robert Elz, who writes:
OpenPOWER on IntegriCloud