Last change
on this file since 389 was 389, checked in by coas-nagasima, 5 years ago |
ビルドが通るよう更新
|
-
Property svn:eol-style
set to
native
-
Property svn:mime-type
set to
text/x-csrc;charset=UTF-8
|
File size:
561 bytes
|
Rev | Line | |
---|
[388] | 1 | #include "time_impl.h"
|
---|
| 2 | #include <errno.h>
|
---|
| 3 |
|
---|
| 4 | time_t mktime(struct tm *tm)
|
---|
| 5 | {
|
---|
| 6 | struct tm new;
|
---|
| 7 | long opp;
|
---|
| 8 | long long t = __tm_to_secs(tm);
|
---|
| 9 |
|
---|
| 10 | __secs_to_zone(t, 1, &new.tm_isdst, &new.__tm_gmtoff, &opp, &new.__tm_zone);
|
---|
| 11 |
|
---|
| 12 | if (tm->tm_isdst>=0 && new.tm_isdst!=tm->tm_isdst)
|
---|
| 13 | t -= opp - new.__tm_gmtoff;
|
---|
| 14 |
|
---|
| 15 | t -= new.__tm_gmtoff;
|
---|
| 16 | if ((time_t)t != t) goto error;
|
---|
| 17 |
|
---|
| 18 | __secs_to_zone(t, 0, &new.tm_isdst, &new.__tm_gmtoff, &opp, &new.__tm_zone);
|
---|
| 19 |
|
---|
| 20 | if (__secs_to_tm(t + new.__tm_gmtoff, &new) < 0) goto error;
|
---|
| 21 |
|
---|
| 22 | *tm = new;
|
---|
| 23 | return t;
|
---|
| 24 |
|
---|
| 25 | error:
|
---|
| 26 | errno = EOVERFLOW;
|
---|
| 27 | return -1;
|
---|
| 28 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.