| 885 | // Parsing helpers |
| 886 | |
| 887 | static |
| 888 | unsigned |
| 889 | parse_dow(std::istream& in) |
| 890 | { |
| 891 | static std::string const dow_names[] = |
| 892 | {"sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"}; |
| 893 | auto s = get_alpha_word(in); |
| 894 | tolower(s); |
| 895 | auto dow = std::find_if(std::begin(dow_names), std::end(dow_names), |
| 896 | [&s](std::string const& dow) |
| 897 | { |
| 898 | return is_prefix_of(s, dow); |
| 899 | }) |
| 900 | - dow_names; |
| 901 | if (dow >= std::end(dow_names) - std::begin(dow_names)) |
| 902 | throw std::runtime_error("oops: bad dow name: " + s); |
| 903 | return static_cast<unsigned>(dow); |
| 904 | } |
| 905 | |
| 906 | static |
| 907 | std::chrono::seconds |
no test coverage detected