return tick observable for each user, user should handle the observable with cell's lifecycle
@param interval timer interval, in TimeUnit.SECOND
@param total total event count
@param intermediate true, get event immediately
@return
@since 3.0.0
430088
public Observable<Long> getTickObservable(int interval, int total, boolean intermediate) {
        return Observable.intervalRange(0, total, intermediate ? 0 : interval, interval, TimeUnit.SECONDS);
    }
330223
synchronized boolean removeInterval(Interval i) {
        calcMinDuration = null;
        calcMaxDuration = null;
        calcMinFinish = null;
        calcMaxFinish = null;
        calcMinStart = null;
        calcMaxStart = null;
        shortestDistancesFromTimeZeroSource = null;
        shortestDistancesFromTimeZeroDestination = null;

        if (directedGraph.remove(i.getStart()) != null) {
            if (directedGraph.remove(i.getFinish()) == null) {
                throw new IllegalStateException();
            }
            intervals.remove(i);
            return true;
        } else {
            return false;
        }
    }
783298
@Override
  public void onTimer(String timerName) {
    if (timerName.equals(IDLE_SESSION_TIMER_NAME)) {
      checkIdleAppSession();
    }
    else if (timerName.equals(TX_TIMER_NAME)) {
      new TxTimerTask(this, sessionData.getTxTimerRequest()).run();
    }
    else {
      logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId());
    }
  }
919752
def tick_reactor(timeout=0)
      begin
        execute_tick(rounded_timeout(timeout))
      rescue StandardError => ex
        @children.each do |child|
          # Skip over any children that should already be reaped for other
          # reasons
          next if (Hermann.jruby? ? child.fulfilled? : child.completed?)

          # Propagate errors to the remaining children
          child.internal_set_error(ex)
        end
      end

      # Reaping the children at this point will also reap any children marked
      # as errored by an exception out of #execute_tick
      return reap_children
    end
1029183
private Interval createInterval(String aName, int aLength) {
		if (aName.equals("1m")){
			System.out.println("CREATE INTERVAL 1M CALLED ");
			new RuntimeException().fillInStackTrace().printStackTrace();
		}
		IntervalImpl interval = new IntervalImpl(obtainNextUniqueId(), aName, aLength);
		
		if (aLength!=-1)
			updateTriggerService.addUpdateable(interval, aLength);
		
		intervalsById.put(interval.getId(), interval);
		intervalsByName.put(interval.getName(), interval);
		for (IntervalRegistryListener listener : registryListeners) {
			listener.intervalCreated(interval);
		}
		
		//add new listener to each interval to store update timestamps
		interval.addSecondaryIntervalListener(new IIntervalListener() {
			@Override
			public void intervalUpdated(Interval aCaller) {
				intervalUpdateTimestamp.put(aCaller.getName(), System.currentTimeMillis());
			}
		});
		return interval;
	}
321149
function TimerEvent() {
        this.addProperty("interval", 1000);
        this.addProperty("event", "tick");
        this.addOutput("on_tick", LiteGraph.EVENT);
        this.time = 0;
        this.last_interval = 1000;
        this.triggered = false;
    }
971248
function(total, timeout) {
  events.EventEmitter.call(this);

  if (! isPositiveInteger(total)) {
    throw new Error('`total` must be a positive integer');
  }

  if (timeout && ! isPositiveInteger(timeout)) {
    throw new Error('`timeout` must be a positive integer');
  }

  this.destroyed = false;
  this.total = total;
	this.fired = 0;
  if (timeout) {
    this.timer = setTimeout(function() {
      this.onTimeout();
    }.bind(this), timeout);
  }
}
974203
public static Boolean eventsAreSameInterval(String eventDate, String secondEventDate) {
		boolean result = false;
		try {
			Interval interval = null;
			Interval secondInterval = null;
            interval = DateUtils.extractDateInterval(eventDate);
            secondInterval = DateUtils.extractDateInterval(secondEventDate);
			logger.debug(interval.toString());
			logger.debug(secondInterval.toString());
            result = interval.equals(secondInterval);
		} catch (IllegalFieldValueException ex) { 
			// field format error, can't parse as date, log at debug level.
			logger.debug(ex.getMessage());
		} catch (Exception e) { 
			logger.error(e.getMessage());
		}
        return result;
	}
1205211
@Override public void intervalUpdated(Interval caller) {
		output.out("===============================================================================");
		output.out("=== SNAPSHOT Interval "+interval.getName()+" updated, Entity: "+id);
		output.out("=== Timestamp: "+Date.currentDate()+", ServiceId: "+target.getProducerId());
		output.out("===============================================================================");
		
		for (IStats stat: target.getStats()){
			output.out(stat.toStatsString(interval.getName()));
		}
		
		output.out("===============================================================================");
		output.out("== END: Interval "+interval.getName()+", Entity: "+id);
		output.out("===============================================================================");
		
	}
508660
public static GsonBuilder registerInterval(GsonBuilder builder)
  {
    if (builder == null) { throw new NullPointerException("builder cannot be null"); }

    builder.registerTypeAdapter(INTERVAL_TYPE, new IntervalConverter());

    return builder;
  }
1116568
public static long getPreviousIntervalStart(long time, int intervalInMinutes, int offsetInMinutes) {
		long interval = MINUTE_IN_MS * intervalInMinutes;
		long offset = calculateOffsetInMs(intervalInMinutes, offsetInMinutes);
		
		return (interval * ((time + LOCAL_UTC_OFFSET - offset) / (interval))) + offset - LOCAL_UTC_OFFSET;
	}
433535
void addAutomaticTimer(AutomaticTimer timer)
    {
        timer.ivMethod = this;
        ivAutomaticTimers.add(timer);

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, "added automatic timer: " + timer);
    }
795448
public static Interval plus(final Interval interval, final Period period) {
    return new Interval(interval.getStart().plus(period),
        interval.getEnd().plus(period));
  }
602906
private void findSentenceIntervals(JCas jcas){
		HashSet<Timex3Interval> timexesToRemove = new HashSet<Timex3Interval>();
		
		FSIterator iterSentence = jcas.getAnnotationIndex(Sentence.type).iterator();
		while (iterSentence.hasNext()) {
			Sentence s=(Sentence)iterSentence.next();
			String sString=s.getCoveredText();
			FSIterator iterInter = jcas.getAnnotationIndex(Timex3Interval.type).subiterator(s);
			int count=0;
			List<Timex3Interval> txes=new ArrayList<Timex3Interval>();
			List<Timex3Interval> sentenceTxes=new ArrayList<Timex3Interval>();
			
			while(iterInter.hasNext()){
				Timex3Interval t=(Timex3Interval)iterInter.next();
				sString=sString.replace(t.getCoveredText(), "<TX3_"+count+">");
				count++;
				txes.add(t);
			}

			if(count>0){

				if (find_interval_candidates){
					IntervalCandidateSentence sI=new IntervalCandidateSentence(jcas);
					sI.setBegin(s.getBegin());
					sI.setEnd(s.getEnd());
					sI.addToIndexes();
				}
				for(Pattern p: hmIntervalPattern.keySet()){
					
					String name=hmIntervalPattern.get(p);
					List<MatchResult>results=(List<MatchResult>)Toolbox.findMatches(p,sString);
					if(results.size()>0){
						//Interval in Sentence s found by Pattern p!
						for(MatchResult r: results){
							Pattern pNorm=Pattern.compile("group\\(([1-9]+)\\)-group\\(([1-9]+)\\)");
							String norm=hmIntervalNormalization.get(name);
							
							Matcher mNorm=pNorm.matcher(norm);
							if(!mNorm.matches()){
								System.err.println("Problem with the Norm in rule "+name);
							}
							Timex3Interval startTx=null,endTx=null;
							try{
								int startId=Integer.parseInt(mNorm.group(1));
								int endId=Integer.parseInt(mNorm.group(2));
								
								startTx=txes.get(Integer.parseInt(r.group(startId)));
								endTx=txes.get(Integer.parseInt(r.group(endId)));
							}catch(Exception e){
								e.printStackTrace();
								return;
							}
							Timex3Interval annotation=new Timex3Interval(jcas);
							annotation.setBegin(startTx.getBegin()>endTx.getBegin()?endTx.getBegin():startTx.getBegin());
							annotation.setEnd(startTx.getEnd()>endTx.getEnd()?startTx.getEnd():endTx.getEnd());
							
							//Does the interval already exist,
							//found by another pattern?
							boolean duplicate=false;
							for(Timex3Interval tx:sentenceTxes){
								if(tx.getBegin()==annotation.getBegin() &&
										tx.getEnd()==annotation.getEnd()){
									duplicate=true;
									break;
								}
							}
							
							if(!duplicate){
								annotation.setTimexValueEB(startTx.getTimexValueEB());
								annotation.setTimexValueLB(startTx.getTimexValueLE());
								annotation.setTimexValueEE(endTx.getTimexValueEB());
								annotation.setTimexValueLE(endTx.getTimexValueLE());
								annotation.setTimexType(startTx.getTimexType());
								annotation.setFoundByRule(name);
								
								
								// create emptyvalue value
								String emptyValue = createEmptyValue(startTx, endTx, jcas);
								annotation.setEmptyValue(emptyValue);
								annotation.setBeginTimex(startTx.getBeginTimex());
								annotation.setEndTimex(endTx.getEndTimex());
								
								try {
									sentenceTxes.add(annotation);
								} catch(NumberFormatException e) {
									Logger.printError(component, "Couldn't do emptyValue calculation on accont of a faulty normalization in " 
											+ annotation.getTimexValueEB() + " or " + annotation.getTimexValueEE());
								}
								
								// prepare tx3intervals to remove
								timexesToRemove.add(startTx);
								timexesToRemove.add(endTx);
								
								annotation.addToIndexes();
//								System.out.println(emptyValue);
							}
						}
					}
				}
			}
		}
		
		for(Timex3Interval txi : timexesToRemove) {
			txi.removeFromIndexes();
		}
	}
993213
private void tickIfNecessary() {
        final long oldTick = lastTick.get();
        final long newTick = clock.tick();
        final long age = newTick - oldTick;
        if (age > TICK_INTERVAL) {
            final long newIntervalStartTick = newTick - age % TICK_INTERVAL;
            if (lastTick.compareAndSet(oldTick, newIntervalStartTick)) {
                final long requiredTicks = age / TICK_INTERVAL;
                for (long i = 0; i < requiredTicks; i++) {
                    m15Rate.tick();
                    m120Rate.tick();
                }
            }
        }
    }
917421
public void register(int interval, @NonNull OnTickListener onTickListener, boolean intermediate) {
        mDefaultTimer.register(interval, onTickListener, intermediate);
    }
1297760
public long getTotalWindowLoadTime(final String intervalName, final TimeUnit unit) {
		return unit.transformMillis(totalWindowLoadTime.getValueAsLong(intervalName));
	}