1*898496eeSXin LI /* $File: localtime_r.c,v 1.4 2022/09/24 20:30:13 christos Exp $ */ 25f0216bdSXin LI 35f0216bdSXin LI #include "file.h" 45f0216bdSXin LI #ifndef lint 5*898496eeSXin LI FILE_RCSID("@(#)$File: localtime_r.c,v 1.4 2022/09/24 20:30:13 christos Exp $") 65f0216bdSXin LI #endif /* lint */ 75f0216bdSXin LI #include <time.h> 85f0216bdSXin LI #include <string.h> 95f0216bdSXin LI 105f0216bdSXin LI /* asctime_r is not thread-safe anyway */ 115f0216bdSXin LI struct tm * localtime_r(const time_t * t,struct tm * tm)129ce06829SXin LIlocaltime_r(const time_t *t, struct tm *tm) 135f0216bdSXin LI { 145f0216bdSXin LI struct tm *tmp = localtime(t); 155f0216bdSXin LI if (tmp == NULL) 165f0216bdSXin LI return NULL; 175f0216bdSXin LI memcpy(tm, tmp, sizeof(*tm)); 185f0216bdSXin LI return tmp; 195f0216bdSXin LI } 20