Here you can find the source of elapsed(long duration, long required)
Parameter | Description |
---|---|
duration | the real time milliseconds. |
required | the amount of milliseconds that is required to have passed the duration in order to succeed |
public static boolean elapsed(long duration, long required)
//package com.java2s; //License from project: Open Source License public class Main { /**// w w w . ja v a2 s . co m * Checks whether a certain amount of milliseconds have elapsed a given time in milliseconds. * This method simply subtracts the given duration from the current time in milliseconds and * checks if the result is greater than the required amount of milliseconds. * <pre> * TimeUtils.elapsed(now - 1000, 1000) = true * TimeUtils.elapsed(now - 999, 1000) = true * TimeUtils.elapsed(now, 1000) = false * </pre> * * @param duration the real time milliseconds. * @param required the amount of milliseconds that is required to have passed the {@code * duration} in order to succeed * * @return whether the {@code required} milliseconds have elapsed the {@code duration} */ public static boolean elapsed(long duration, long required) { return System.currentTimeMillis() - duration >= required; } }