public bool CanHandle(ITimeRetrievalService timeRetrievalService) { var currentTime = timeRetrievalService.Now(); var start = new TimeSpan(06, 0, 0); var end = new TimeSpan(12, 0, 0); return(currentTime >= start && currentTime <= end); }
public bool CanHandle(ITimeRetrievalService timeRetrievalService) { var currentTime = timeRetrievalService.Now(); var start = new TimeSpan(22, 0, 0); var end = new TimeSpan(06, 0, 0); if (start < end) { return(start <= currentTime && currentTime <= end); } return(!(end < currentTime && currentTime < start)); }