| 18 | } |
| 19 | |
| 20 | static bool HttpDateToTm(const char* str, struct tm* tm) |
| 21 | { |
| 22 | locale_t c_locate = GetCLocale(); |
| 23 | char* end; |
| 24 | |
| 25 | if ((end = strptime_l(str, "%c", tm, c_locate)) && *end == '\0') |
| 26 | return true; |
| 27 | |
| 28 | // rfc1123-date |
| 29 | if ((end = strptime_l(str, "%a, %d %b %Y %H:%M:%S GMT", tm, c_locate)) |
| 30 | && *end == '\0') |
| 31 | return true; |
| 32 | |
| 33 | // rfc950-date |
| 34 | if ((end = strptime_l(str, "%A, %d-%b-%y %H:%M:%S GMT", tm, c_locate)) |
| 35 | && *end == '\0') |
| 36 | return true; |
| 37 | |
| 38 | return false; |
| 39 | } |
| 40 | |
| 41 | bool ParseHttpTime(const char* str, time_t* time) |
| 42 | { |
no test coverage detected