xref: /freebsd/contrib/ldns/compat/ctime_r.c (revision cfe30d02adda7c3b5c76156ac52d50d8cab325d9)
1*7b5038d7SDag-Erling Smørgrav #ifdef HAVE_CONFIG_H
2*7b5038d7SDag-Erling Smørgrav #include <ldns/config.h>
3*7b5038d7SDag-Erling Smørgrav #endif
4*7b5038d7SDag-Erling Smørgrav 
5*7b5038d7SDag-Erling Smørgrav #ifdef HAVE_TIME_H
6*7b5038d7SDag-Erling Smørgrav #include <time.h>
7*7b5038d7SDag-Erling Smørgrav #endif
8*7b5038d7SDag-Erling Smørgrav 
ctime_r(const time_t * timep,char * buf)9*7b5038d7SDag-Erling Smørgrav char *ctime_r(const time_t *timep, char *buf)
10*7b5038d7SDag-Erling Smørgrav {
11*7b5038d7SDag-Erling Smørgrav 	/* no thread safety. */
12*7b5038d7SDag-Erling Smørgrav 	char* result = ctime(timep);
13*7b5038d7SDag-Erling Smørgrav 	if(buf && result)
14*7b5038d7SDag-Erling Smørgrav 		strcpy(buf, result);
15*7b5038d7SDag-Erling Smørgrav 	return result;
16*7b5038d7SDag-Erling Smørgrav }
17