| 11 | #include <boost/test/unit_test.hpp> |
| 12 | |
| 13 | tm make_tm(std::string s) |
| 14 | { |
| 15 | int dst = -1; |
| 16 | size_t l = strlen("YYYY-MM-DD HH:MM:SS"); |
| 17 | if (s.size() > l) { |
| 18 | std::string zone = s.substr(l); |
| 19 | if (zone == " PST") { |
| 20 | dst = 0; |
| 21 | } else if (zone == " PDT") { |
| 22 | dst = 1; |
| 23 | } else { |
| 24 | // tests should only use PST/PDT (for now) |
| 25 | BOOST_CHECK_MESSAGE(false, "invalid or unknown time time: " << zone); |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | std::tm t = {}; |
| 30 | std::istringstream stream(s); |
| 31 | stream >> std::get_time(&t, "%Y-%m-%d %H:%M:%S"); |
| 32 | t.tm_isdst = dst; |
| 33 | |
| 34 | return t; |
| 35 | } |
| 36 | |
| 37 | #ifndef _WIN32 |
| 38 | const char *GlobalTimezoneFixture::TestTimezoneWithDST = "America/Los_Angeles"; |
no test coverage detected