gmtime_r.c 436 B

12345678910111213141516171819
  1. /* $File: gmtime_r.c,v 1.2 2015/07/11 14:41:37 christos Exp $ */
  2. #include "file.h"
  3. #ifndef lint
  4. FILE_RCSID("@(#)$File: gmtime_r.c,v 1.2 2015/07/11 14:41:37 christos Exp $")
  5. #endif /* lint */
  6. #include <time.h>
  7. #include <string.h>
  8. /* asctime_r is not thread-safe anyway */
  9. struct tm *
  10. gmtime_r(const time_t *t, struct tm *tm)
  11. {
  12. struct tm *tmp = gmtime(t);
  13. if (tmp == NULL)
  14. return NULL;
  15. memcpy(tm, tmp, sizeof(*tm));
  16. return tmp;
  17. }