localtime.c 320 B

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