| 210 | using ::operator==; |
| 211 | |
| 212 | bool IsActive(Timespan span, std::tm const & time) |
| 213 | { |
| 214 | // Timespan with e.h. should be split into parts with no e.h. |
| 215 | // before calling IsActive(). |
| 216 | // TODO(mgsergio): set assert(!span.HasExtendedHours()) |
| 217 | |
| 218 | span.ExpandPlus(); |
| 219 | if (span.HasStart() && span.HasEnd()) |
| 220 | { |
| 221 | THourMinutes start; |
| 222 | THourMinutes end; |
| 223 | THourMinutes toBeChecked; |
| 224 | |
| 225 | if (!ToHourMinutes(span.GetStart(), start)) |
| 226 | return false; |
| 227 | |
| 228 | if (!ToHourMinutes(span.GetEnd(), end)) |
| 229 | return false; |
| 230 | |
| 231 | if (!ToHourMinutes(time, toBeChecked)) |
| 232 | return false; |
| 233 | |
| 234 | return start <= toBeChecked && toBeChecked <= end; |
| 235 | } |
| 236 | else if (span.HasStart() && span.HasPlus()) |
| 237 | { |
| 238 | // TODO(mgsergio): Not implemented yet |
| 239 | return false; |
| 240 | } |
| 241 | return false; |
| 242 | } |
| 243 | |
| 244 | bool IsActive(WeekdayRange const & range, std::tm const & date) |
| 245 | { |
no test coverage detected