localtime.c 388 B

123456789101112131415161718192021222324
  1. #include <time.h>
  2. #include <sys/time.h>
  3. /* Our static data lives in __time_static.c */
  4. extern struct tm __tmb;
  5. extern void __tm_conv();
  6. struct tm *localtime(__const time_t *timep)
  7. {
  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. }