xref: /freebsd/contrib/file/src/gmtime_r.c (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1 /*	$File: gmtime_r.c,v 1.4 2022/09/24 20:30:13 christos Exp $	*/
2 
3 #include "file.h"
4 #ifndef	lint
5 FILE_RCSID("@(#)$File: gmtime_r.c,v 1.4 2022/09/24 20:30:13 christos Exp $")
6 #endif	/* lint */
7 #include <time.h>
8 #include <string.h>
9 
10 /* asctime_r is not thread-safe anyway */
11 struct tm *
12 gmtime_r(const time_t *t, struct tm *tm)
13 {
14 	struct tm *tmp = gmtime(t);
15 	if (tmp == NULL)
16 		return NULL;
17 	memcpy(tm, tmp, sizeof(*tm));
18 	return tmp;
19 }
20