summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1998-04-19 06:47:25 +0000
committerphk <phk@FreeBSD.org>1998-04-19 06:47:25 +0000
commit6d7eb64b154e7f047a65106576dd82344464d1c4 (patch)
tree0dda0ba870015247bab30960b84ca60fcf8eb871 /lib/libc
parent538a55c2428a63d5e8d41bde9560d3afb3009433 (diff)
downloadFreeBSD-src-6d7eb64b154e7f047a65106576dd82344464d1c4.zip
FreeBSD-src-6d7eb64b154e7f047a65106576dd82344464d1c4.tar.gz
ctime_r and asctime_r are not implemented.
prototypes in time.h do not match POSIX. PR: 6345 Reviewed by: phk Submitted by: Dmitry Khrustalev <dima@xyzzy.machaon.ru>
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/stdtime/asctime.c15
-rw-r--r--lib/libc/stdtime/localtime.c9
2 files changed, 21 insertions, 3 deletions
diff --git a/lib/libc/stdtime/asctime.c b/lib/libc/stdtime/asctime.c
index a1834b6..832f185 100644
--- a/lib/libc/stdtime/asctime.c
+++ b/lib/libc/stdtime/asctime.c
@@ -18,9 +18,20 @@ static char elsieid[] = "@(#)asctime.c 7.7";
** A la X3J11, with core dump avoidance.
*/
+
char *
asctime(timeptr)
-register const struct tm * timeptr;
+const struct tm * timeptr;
+{
+ static char result[3 * 2 + 5 * INT_STRLEN_MAXIMUM(int) +
+ 3 + 2 + 1 + 1];
+ return(asctime_r(timeptr, result));
+}
+
+char *
+asctime_r(timeptr, result)
+const struct tm * timeptr;
+char *result;
{
static const char wday_name[][3] = {
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
@@ -36,8 +47,6 @@ register const struct tm * timeptr;
** three explicit spaces, two explicit colons, a newline,
** and a trailing ASCII nul).
*/
- static char result[3 * 2 + 5 * INT_STRLEN_MAXIMUM(int) +
- 3 + 2 + 1 + 1];
register const char * wn;
register const char * mn;
diff --git a/lib/libc/stdtime/localtime.c b/lib/libc/stdtime/localtime.c
index 5de39d6..61614c7 100644
--- a/lib/libc/stdtime/localtime.c
+++ b/lib/libc/stdtime/localtime.c
@@ -1345,6 +1345,15 @@ const time_t * const timep;
return asctime(localtime(timep));
}
+char *
+ctime_r(timep, buf)
+const time_t * const timep;
+char *buf;
+{
+ struct tm tm;
+ return asctime_r(localtime_r(timep, &tm), buf);
+}
+
/*
** Adapted from code provided by Robert Elz, who writes:
** The "best" way to do mktime I think is based on an idea of Bob
OpenPOWER on IntegriCloud