Example usage for org.apache.wicket.util.time Duration elapsed

List of usage examples for org.apache.wicket.util.time Duration elapsed

Introduction

In this page you can find the example usage for org.apache.wicket.util.time Duration elapsed.

Prototype

public static Duration elapsed(final Time start) 

Source Link

Document

Calculates the amount of time elapsed since start time.

Usage

From source file:de.alpharogroup.wicket.base.application.BaseWebApplication.java

License:Apache License

/**
 * Gets the elapsed duration since this application was initialized.
 *
 * @return the uptime//from   ww w .jav a 2  s .c o  m
 */
public Duration getUptime() {
    final DateTime startup = getStartupDate();
    if (null != startup) {
        return Duration.elapsed(Time.valueOf(startup.toDate()));
    }
    return Duration.NONE;
}

From source file:fiftyfive.wicket.FoundationApplication.java

License:Apache License

/**
 * Returns the amount of time elapsed since this application was
 * initialized by the Wicket framework./*from   w w w.  ja  va2 s. c om*/
 * 
 * @since 2.0
 */
public Duration getUptime() {
    Date start = getStartupDate();
    if (null == start) {
        return Duration.milliseconds(0);
    }
    return Duration.elapsed(Time.valueOf(start));
}

From source file:fiftyfive.wicket.util.LoggingUtils.java

License:Apache License

/**
 * Returns the amount of time the current request has taken up until
 * this point.//w ww  .  j av a  2s  .  c om
 */
public static Duration getRequestDuration() {
    Time start = Time.millis(RequestCycle.get().getStartTime());
    return Duration.elapsed(start);
}

From source file:fiftyfive.wicket.util.LoggingUtils.java

License:Apache License

/**
 * Returns a Duration of time elapsed since the specified date, or
 * {@code null} or the date is {@code null}.
 */// ww w  . j a  v  a 2s. c o  m
private static Duration nullSafeElapsed(Date since) {
    return null == since ? null : Duration.elapsed(Time.valueOf(since));
}