ctime_r.c 370 B

1234567891011121314151617181920212223242526
  1. #include <time.h>
  2. #include <sys/time.h>
  3. extern void __tm_conv();
  4. extern void __asctime();
  5. char *ctime_r(timep, buf)
  6. __const time_t *timep;
  7. char *buf;
  8. {
  9. struct tm tmb;
  10. struct timezone tz;
  11. time_t offt;
  12. gettimeofday((void *) 0, &tz);
  13. offt = -tz.tz_minuteswest * 60L;
  14. /* tmb.tm_isdst = ? */
  15. __tm_conv(&tmb, timep, offt);
  16. __asctime(buf, &tmb);
  17. return buf;
  18. }