| 111 | } |
| 112 | |
| 113 | std::time_t LocaltimeCondition::stringToDaytime(const std::string& string) |
| 114 | { |
| 115 | USBGUARD_LOG(Trace) << "string=" << string; |
| 116 | struct ::tm tm = { }; |
| 117 | |
| 118 | if (::strptime(string.c_str(), "%H:%M:%s", &tm) == nullptr) { |
| 119 | if (::strptime(string.c_str(), "%H:%M", &tm) == nullptr) { |
| 120 | throw Exception("LocaltimeCondition", "Invalid time or range format", string); |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | USBGUARD_LOG(Trace) << "tm=" << tmToString(&tm); |
| 125 | return tm.tm_sec + 60*tm.tm_min + 60*60*tm.tm_hour; |
| 126 | } |
| 127 | } /* namespace usbguard */ |
| 128 | |
| 129 | /* vim: set ts=2 sw=2 et */ |
nothing calls this directly
no test coverage detected