xref: /freebsd/contrib/file/src/ctime_r.c (revision 898496ee09ed2b7d25f6807edc4515628196ec0a)
1*898496eeSXin LI /*	$File: ctime_r.c,v 1.3 2022/09/24 20:30:13 christos Exp $	*/
2b6cee71dSXin LI 
3b6cee71dSXin LI #include "file.h"
4b6cee71dSXin LI #ifndef	lint
5*898496eeSXin LI FILE_RCSID("@(#)$File: ctime_r.c,v 1.3 2022/09/24 20:30:13 christos Exp $")
6b6cee71dSXin LI #endif	/* lint */
7b6cee71dSXin LI #include <time.h>
8b6cee71dSXin LI #include <string.h>
9b6cee71dSXin LI 
10b6cee71dSXin LI /* ctime_r is not thread-safe anyway */
11b6cee71dSXin LI char *
ctime_r(const time_t * t,char * dst)12b6cee71dSXin LI ctime_r(const time_t *t, char *dst)
13b6cee71dSXin LI {
14b6cee71dSXin LI 	char *p = ctime(t);
15b6cee71dSXin LI 	if (p == NULL)
16b6cee71dSXin LI 		return NULL;
17b6cee71dSXin LI 	memcpy(dst, p, 26);
18b6cee71dSXin LI 	return dst;
19b6cee71dSXin LI }
20