Example usage for org.apache.commons.lang.time DateUtils MILLIS_PER_MINUTE

List of usage examples for org.apache.commons.lang.time DateUtils MILLIS_PER_MINUTE

Introduction

In this page you can find the example usage for org.apache.commons.lang.time DateUtils MILLIS_PER_MINUTE.

Prototype

long MILLIS_PER_MINUTE

To view the source code for org.apache.commons.lang.time DateUtils MILLIS_PER_MINUTE.

Click Source Link

Document

Number of milliseconds in a standard minute.

Usage

From source file:com.pureinfo.srm.config.notice.TestTimer.java

public static void main(String[] args) throws ParseException {
    Calendar start = new GregorianCalendar();
    start.setTime(format.parse("18:40"));
    Calendar cal = new GregorianCalendar();
    start.set(Calendar.YEAR, cal.get(Calendar.YEAR));
    start.set(Calendar.MONTH, cal.get(Calendar.MONTH));
    start.set(Calendar.DAY_OF_MONTH, cal.get(Calendar.DAY_OF_MONTH));
    while (start.before(cal)) {
        start.setTimeInMillis(start.getTimeInMillis() + DateUtils.MILLIS_PER_MINUTE);
    }/*  w w  w.  ja v a  2s  .c o  m*/
    new Timer().scheduleAtFixedRate(new test1(), start.getTime(), DateUtils.MILLIS_PER_MINUTE);
}

From source file:mitm.common.util.DateTimeUtils.java

public static long millisecondsToMinutes(long milliseconds) {
    return (long) (milliseconds / DateUtils.MILLIS_PER_MINUTE);
}

From source file:eagle.alert.dedup.DefaultDeduplicator.java

public AlertDeduplicationStatus checkDedup(EntityTagsUniq key) {
    long current = key.timestamp;
    if (!entites.containsKey(key)) {
        entites.put(key, current);//from   w  ww.j  av a2 s .  c  om
        return AlertDeduplicationStatus.NEW;
    }

    long last = entites.get(key);
    if (current - last >= dedupIntervalMin * DateUtils.MILLIS_PER_MINUTE) {
        entites.put(key, current);
        return AlertDeduplicationStatus.DUPLICATED;
    }

    return AlertDeduplicationStatus.IGNORED;
}

From source file:mitm.common.cache.ContentCacheImplTest.java

@Before
public void before() {
    cache = new ContentCacheImpl(DateUtils.MILLIS_PER_MINUTE * 5);

    cache.start();
}

From source file:mitm.common.util.DateTimeUtils.java

public static long minutesToMilliseconds(long minutes) {
    return (long) (minutes * DateUtils.MILLIS_PER_MINUTE);
}

From source file:edu.wisc.my.stats.domain.TimeResolution.java

/**
 * Returns the number of instances of the resolution that occur between the two dates.
 * //from  w w  w.j  a va  2s  .c  o  m
 * @param start The start date in milliseconds - inclusive. See {@link Date#getTime()}
 * @param end The end date in milliseconds - exclusive. See {@link Date#getTime()}
 * @return The number of instances between the two ex: 8/1/2006 12:00:00.000 AM to 8/2/2006 12:00:00.000 AM for {@link #HOUR} should return 24.
 */
public long instanceCount(long start, long end) {
    if (end <= start) {
        throw new IllegalArgumentException("Start must be before end");
    }

    final long milliDiff = end - start;
    final long minuteDiff = milliDiff / DateUtils.MILLIS_PER_MINUTE;
    final long instances = minuteDiff / this.minutes;

    return instances;
}

From source file:mitm.application.djigzo.impl.DjigzoFactoryPropertiesImpl.java

@Override
public long getCRLDownloadParametersTotalTimeout() throws HierarchicalPropertiesException {
    return HierarchicalPropertiesUtils.getLong(sourceProperties,
            getPropertyName("cRLDownloadParameters.totalTimeout"), 15 * DateUtils.MILLIS_PER_MINUTE, false);
}

From source file:mitm.common.util.DateTimeUtils.java

public static long diffMinutes(Date date1, Date date2) {
    return (date1.getTime() - date2.getTime()) / DateUtils.MILLIS_PER_MINUTE;
}

From source file:com.fengduo.bee.commons.util.DateViewTools.java

/**
 * ?/*from w ww  . j ava  2  s.c  o  m*/
 * 
 * @param date
 * @return
 */
public static boolean isExpiredForMin(String date) {
    try {
        Date expect = getFormat(FULL_DATE_FORMAT_PATTERN).parse(date);
        long expectTime = expect.getTime();
        long now = System.currentTimeMillis();
        return (now - expectTime) / DateUtils.MILLIS_PER_MINUTE >= 0;
    } catch (Exception e) {
        logger.error("Format date faield", e.getMessage());
        return false;
    }
}

From source file:mitm.application.djigzo.impl.DjigzoFactoryPropertiesImpl.java

@Override
public long getCRLDownloadParametersConnectTimeout() throws HierarchicalPropertiesException {
    return HierarchicalPropertiesUtils.getLong(sourceProperties,
            getPropertyName("cRLDownloadParameters.connectTimeout"), 2 * DateUtils.MILLIS_PER_MINUTE, false);
}