public void updateTime(long time) {
        if (time > currentTime) {
            for (Object detector : detectors.values()) {
                ((DaysStayTimeDetector) detector).update(time);
            }
            for (Object daysO : workerDays.entrySet()) {
                Set<Long> days = ((Map.Entry<String, Set<Long>>) daysO).getValue();
                if (days.size() >= metrics.daysThreshold) {
                    for (Iterator<Long> iterator = days.iterator(); iterator.hasNext(); ) {
                        Long next = iterator.next();
                        if (next - currentTime > metrics.daysThreshold * ONE_DAY) {
                            iterator.remove();
                        }
                    }
                    if (days.size() < metrics.daysThreshold) {
                        listener.onChange(((Map.Entry<String, Set<Long>>) daysO).getKey(), days.size(), metrics.daysThreshold);
                    }
                }
            }
            currentTime = time;
        }
    }