| 167 | } |
| 168 | |
| 169 | int64_t ParseISO8601DateTime(const std::string& str) |
| 170 | { |
| 171 | static const boost::posix_time::ptime epoch = boost::posix_time::from_time_t(0); |
| 172 | static const std::locale loc(std::locale::classic(), |
| 173 | new boost::posix_time::time_input_facet("%Y-%m-%dT%H:%M:%SZ")); |
| 174 | std::istringstream iss(str); |
| 175 | iss.imbue(loc); |
| 176 | boost::posix_time::ptime ptime(boost::date_time::not_a_date_time); |
| 177 | iss >> ptime; |
| 178 | if (ptime.is_not_a_date_time() || epoch > ptime) |
| 179 | return 0; |
| 180 | return (ptime - epoch).total_seconds(); |
| 181 | } |
| 182 | |
| 183 | struct timeval MillisToTimeval(int64_t nTimeout) |
| 184 | { |
no outgoing calls