Last change
on this file since 349 was 337, checked in by coas-nagasima, 6 years ago |
ASP3版ECNLを追加
|
-
Property svn:eol-style
set to
native
-
Property svn:mime-type
set to
text/x-csrc;charset=UTF-8
|
File size:
482 bytes
|
Rev | Line | |
---|
[337] | 1 | #include "time_impl.h"
|
---|
| 2 |
|
---|
| 3 | long long __tm_to_secs(const struct tm *tm)
|
---|
| 4 | {
|
---|
| 5 | int is_leap;
|
---|
| 6 | long long year = tm->tm_year;
|
---|
| 7 | int month = tm->tm_mon;
|
---|
| 8 | if (month >= 12 || month < 0) {
|
---|
| 9 | int adj = month / 12;
|
---|
| 10 | month %= 12;
|
---|
| 11 | if (month < 0) {
|
---|
| 12 | adj--;
|
---|
| 13 | month += 12;
|
---|
| 14 | }
|
---|
| 15 | year += adj;
|
---|
| 16 | }
|
---|
| 17 | long long t = __year_to_secs(year, &is_leap);
|
---|
| 18 | t += __month_to_secs(month, is_leap);
|
---|
| 19 | t += 86400LL * (tm->tm_mday-1);
|
---|
| 20 | t += 3600LL * tm->tm_hour;
|
---|
| 21 | t += 60LL * tm->tm_min;
|
---|
| 22 | t += tm->tm_sec;
|
---|
| 23 | return t;
|
---|
| 24 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.