1/* $NetBSD: localtime_r.c,v 1.1.1.2 2023/08/18 18:36:49 christos Exp $ */ 2 3/* $File: localtime_r.c,v 1.4 2022/09/24 20:30:13 christos Exp $ */ 4 5#include "file.h" 6#ifndef lint 7#if 0 8FILE_RCSID("@(#)$File: localtime_r.c,v 1.4 2022/09/24 20:30:13 christos Exp $") 9#else 10__RCSID("$NetBSD: localtime_r.c,v 1.1.1.2 2023/08/18 18:36:49 christos Exp $"); 11#endif 12#endif /* lint */ 13#include <time.h> 14#include <string.h> 15 16/* asctime_r is not thread-safe anyway */ 17struct tm * 18localtime_r(const time_t *t, struct tm *tm) 19{ 20 struct tm *tmp = localtime(t); 21 if (tmp == NULL) 22 return NULL; 23 memcpy(tm, tmp, sizeof(*tm)); 24 return tmp; 25} 26