858cd50d012bfacd0aabf735e35d956a51e4967b
[musl] / src / time / mktime.c
1 #include <time.h>
2
3 #include "__time.h"
4
5 time_t mktime(struct tm *tm)
6 {
7         int isdst = tm->tm_isdst;
8         time_t t, lt;
9
10         __tzset();
11
12         tm->tm_sec += __timezone;
13         if (isdst > 0) tm->tm_sec += __dst_offset;
14
15         t = __tm_to_time(tm);
16         
17         lt = t - __timezone;
18         if (isdst > 0) lt -= __dst_offset;
19         __time_to_tm(lt, tm);
20
21         __dst_adjust(tm);
22         
23         return t;
24 }