]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/file/src/localtime_r.c
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / file / src / localtime_r.c
1 /*      $File: localtime_r.c,v 1.1 2015/01/09 19:28:32 christos Exp $   */
2
3 #include "file.h"
4 #ifndef lint
5 FILE_RCSID("@(#)$File: localtime_r.c,v 1.1 2015/01/09 19:28:32 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 localtime_r(const time_t t, struct tm *tm)
13 {
14         struct tm *tmp = localtime(t);
15         if (tmp == NULL)
16                 return NULL;
17         memcpy(tm, tmp, sizeof(*tm));
18         return tmp;
19 }