asctime_r.c 415 B

12345678910111213141516171819
  1. /* $File: asctime_r.c,v 1.3 2022/09/24 20:30:13 christos Exp $ */
  2. #include "file.h"
  3. #ifndef lint
  4. FILE_RCSID("@(#)$File: asctime_r.c,v 1.3 2022/09/24 20:30:13 christos Exp $")
  5. #endif /* lint */
  6. #include <time.h>
  7. #include <string.h>
  8. /* asctime_r is not thread-safe anyway */
  9. char *
  10. asctime_r(const struct tm *t, char *dst)
  11. {
  12. char *p = asctime(t);
  13. if (p == NULL)
  14. return NULL;
  15. memcpy(dst, p, 26);
  16. return dst;
  17. }