Java Code Examples for org.apache.commons.lang3.time.DurationFormatUtils#formatDurationHMS()

The following examples show how to use org.apache.commons.lang3.time.DurationFormatUtils#formatDurationHMS() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Clock.java    From dhis2-core with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Timestamps the given message using the elapsed time of this Clock and
 * logs it using the logger.
 * @param message the message to log.
 * @return this Clock.
 */
public Clock logTime( String message )
{
    super.split();
    
    String time = DurationFormatUtils.formatDurationHMS( super.getSplitTime() ); 
    
    String msg = message + SEPARATOR + time;
    
    if ( log != null )
    {
        log.info( msg );
    }
    else
    {
        defaultLog.info( msg );
    }
    
    return this;
}
 
Example 2
Source File: Clock.java    From dhis2-core with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Yields the elapsed time since the Clock was started as an HMS String.
 * @return the elapsed time.
 */
public String time()
{
    super.split();
    
    return DurationFormatUtils.formatDurationHMS( super.getSplitTime() );
}
 
Example 3
Source File: HistoryEvent.java    From arcusandroid with Apache License 2.0 4 votes vote down vote up
private String formatDuration() {
    Date end = clearedAt == null ? new Date() : clearedAt;
    long durationInMs = end.getTime() - triggeredAt.getTime();
    String formatted = DurationFormatUtils.formatDurationHMS(durationInMs);
    return reformatDuration(formatted);
}
 
Example 4
Source File: DatabaseSteps.java    From vividus with Apache License 2.0 4 votes vote down vote up
public String getExecutionTime()
{
    return DurationFormatUtils.formatDurationHMS(stopwatch.getTime());
}
 
Example 5
Source File: DateFormatUtil.java    From vjtools with Apache License 2.0 2 votes vote down vote up
/**
 * 按HH:mm:ss.SSS格式,格式化时间间隔.
 * 
 * endDate必须大于startDate,间隔可大于1天,
 * 
 * @see DurationFormatUtils
 */
public static String formatDuration(@NotNull Date startDate, @NotNull Date endDate) {
	return DurationFormatUtils.formatDurationHMS(endDate.getTime() - startDate.getTime());
}
 
Example 6
Source File: DateFormatUtil.java    From vjtools with Apache License 2.0 2 votes vote down vote up
/**
 * 按HH:mm:ss.SSS格式,格式化时间间隔
 * 
 * 单位为毫秒,必须大于0,可大于1天
 * 
 * @see DurationFormatUtils
 */
public static String formatDuration(long durationMillis) {
	return DurationFormatUtils.formatDurationHMS(durationMillis);
}
 
Example 7
Source File: DateFormatTools.java    From pampas with Apache License 2.0 2 votes vote down vote up
/**
 * 按HH:mm:ss.SSS格式,格式化时间间隔.
 * <p>
 * endDate必须大于startDate,间隔可大于1天,
 *
 * @param startDate the start date
 * @param endDate   the end date
 * @return the string
 */
public static String formatDuration(Date startDate, Date endDate) {
    return DurationFormatUtils.formatDurationHMS(endDate.getTime() - startDate.getTime());
}
 
Example 8
Source File: DateFormatTools.java    From pampas with Apache License 2.0 2 votes vote down vote up
/**
 * 按HH:mm:ss.SSS格式,格式化时间间隔
 * <p>
 * 单位为毫秒,必须大于0,可大于1天
 *
 * @param durationMillis the duration millis
 * @return the string
 */
public static String formatDuration(long durationMillis) {
    return DurationFormatUtils.formatDurationHMS(durationMillis);
}
 
Example 9
Source File: DateFormatUtil.java    From vjtools with Apache License 2.0 2 votes vote down vote up
/**
 * 按HH:mm:ss.SSS格式,格式化时间间隔.
 * 
 * endDate必须大于startDate,间隔可大于1天,
 * 
 * @see DurationFormatUtils
 */
public static String formatDuration(@NotNull Date startDate, @NotNull Date endDate) {
	return DurationFormatUtils.formatDurationHMS(endDate.getTime() - startDate.getTime());
}
 
Example 10
Source File: DateFormatUtil.java    From vjtools with Apache License 2.0 2 votes vote down vote up
/**
 * 按HH:mm:ss.SSS格式,格式化时间间隔
 * 
 * 单位为毫秒,必须大于0,可大于1天
 * 
 * @see DurationFormatUtils
 */
public static String formatDuration(long durationMillis) {
	return DurationFormatUtils.formatDurationHMS(durationMillis);
}
 
Example 11
Source File: DateFormatUtil.java    From j360-dubbo-app-all with Apache License 2.0 2 votes vote down vote up
/**
 * 按HH:mm:ss.SSS格式,格式化时间间隔.
 * 
 * endDate必须大于startDate,间隔可大于1天,
 */
public static String formatDuration(@NotNull Date startDate, @NotNull Date endDate) {
	return DurationFormatUtils.formatDurationHMS(endDate.getTime() - startDate.getTime());
}
 
Example 12
Source File: DateFormatUtil.java    From j360-dubbo-app-all with Apache License 2.0 2 votes vote down vote up
/**
 * 按HH:mm:ss.SSS格式,格式化时间间隔
 * 
 * 单位为毫秒,必须大于0,可大于1天
 */
public static String formatDuration(long durationMillis) {
	return DurationFormatUtils.formatDurationHMS(durationMillis);
}