| 89 | } |
| 90 | |
| 91 | time_t ToTimeT(time_t defaultValue) const { |
| 92 | if (!IsOk()) { |
| 93 | return defaultValue; |
| 94 | } |
| 95 | struct tm tm; |
| 96 | Zero(tm); |
| 97 | tm.tm_year = Year - 1900; |
| 98 | tm.tm_mon = Month - 1; |
| 99 | tm.tm_mday = Day; |
| 100 | tm.tm_hour = Hour; |
| 101 | tm.tm_min = Minute; |
| 102 | tm.tm_sec = Second; |
| 103 | time_t tt = TimeGM(&tm); |
| 104 | if (tt == -1) { |
| 105 | return defaultValue; |
| 106 | } |
| 107 | return tt - ZoneOffsetMinutes * 60; |
| 108 | } |
| 109 | }; |
| 110 | |
| 111 | class TDateTimeParserBase { |