Here you can find the source of hasExpiredMillis(long now, long eventTime, long timeBuffer)
Parameter | Description |
---|---|
now | Current instant. |
eventTime | Instant at which the event took place. |
timeBuffer | The amount of time for which the event is valid (in milliseconds). |
true
if the event has expired, false
otherwise
public static boolean hasExpiredMillis(long now, long eventTime, long timeBuffer)
//package com.java2s; /*/*from www. j a v a2s . c o m*/ * Copyright 2010 Bruno de Carvalho * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ public class Main { /** * Test whether a given event has timed out (in milliseconds). * * @param now Current instant. * @param eventTime Instant at which the event took place. * @param timeBuffer The amount of time for which the event is valid (in milliseconds). * @return <code>true</code> if the event has expired, <code>false</code> otherwise */ public static boolean hasExpiredMillis(long now, long eventTime, long timeBuffer) { return (eventTime + timeBuffer) < now; } }