mktime.c 340 B

123456789101112131415161718192021222324
  1. #include <time.h>
  2. #include "__time.h"
  3. time_t mktime(struct tm *tm)
  4. {
  5. int isdst = tm->tm_isdst;
  6. time_t t, lt;
  7. __tzset();
  8. tm->tm_sec += __timezone;
  9. if (isdst > 0) tm->tm_sec += __dst_offset;
  10. t = __tm_to_time(tm);
  11. lt = t - __timezone;
  12. if (isdst > 0) lt -= __dst_offset;
  13. __time_to_tm(lt, tm);
  14. __dst_adjust(tm);
  15. return t;
  16. }