當前位置: 首頁>>代碼示例>>Java>>正文


Java DurationFormatUtils.formatDurationHMS方法代碼示例

本文整理匯總了Java中org.apache.commons.lang3.time.DurationFormatUtils.formatDurationHMS方法的典型用法代碼示例。如果您正苦於以下問題:Java DurationFormatUtils.formatDurationHMS方法的具體用法?Java DurationFormatUtils.formatDurationHMS怎麽用?Java DurationFormatUtils.formatDurationHMS使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.lang3.time.DurationFormatUtils的用法示例。


在下文中一共展示了DurationFormatUtils.formatDurationHMS方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: logTime

import org.apache.commons.lang3.time.DurationFormatUtils; //導入方法依賴的package包/類
/**
 * 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;
}
 
開發者ID:dhis2,項目名稱:dhis2-core,代碼行數:26,代碼來源:Clock.java

示例2: time

import org.apache.commons.lang3.time.DurationFormatUtils; //導入方法依賴的package包/類
/**
 * 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() );
}
 
開發者ID:dhis2,項目名稱:dhis2-core,代碼行數:11,代碼來源:Clock.java

示例3: create

import org.apache.commons.lang3.time.DurationFormatUtils; //導入方法依賴的package包/類
public static TestMetadata create(final String rawResultsDir, final Properties properties) {
	ZonedDateTime start = ZonedDateTime.parse(properties.getProperty("test.start"), DateTimeFormatter.ISO_OFFSET_DATE_TIME);
	ZonedDateTime end = ZonedDateTime.parse(properties.getProperty("test.finish"), DateTimeFormatter.ISO_OFFSET_DATE_TIME);
	String duration = DurationFormatUtils.formatDurationHMS(Duration.between(start, end).toMillis());

	String operationsString = properties.getProperty("operations");
	Set<String> operations = newTreeSet(on(',').trimResults().split(operationsString));
	return new TestMetadata(start, end, duration, properties.getProperty("test.file"), rawResultsDir,
			properties.getProperty("perfload.implementation.version"), properties.getProperty("test.comment"), operations);
}
 
開發者ID:mgm-tp,項目名稱:perfload-perfalyzer,代碼行數:11,代碼來源:TestMetadata.java

示例4: formatMillis

import org.apache.commons.lang3.time.DurationFormatUtils; //導入方法依賴的package包/類
private String formatMillis(double millis)
{
    return DurationFormatUtils.formatDurationHMS((Double.valueOf(Math.abs(millis))).longValue());
}
 
開發者ID:marcelovca90,項目名稱:anti-spam-weka-gui,代碼行數:5,代碼來源:ExperimentHelper.java

示例5: writeTestDetails

import org.apache.commons.lang3.time.DurationFormatUtils; //導入方法依賴的package包/類
/**
 * Dump summary data for a test
 */
protected void writeTestDetails(Writer writer, String notes) throws Exception
{
    ResultService resultService = getResultService();
    // Get the test result times
    EventRecord firstResult = resultService.getFirstResult();
    long firstEventTime = firstResult == null ? System.currentTimeMillis() : firstResult.getStartTime();
    Date firstEventDate = new Date(firstEventTime);
    EventRecord lastResult = resultService.getLastResult();
    long lastEventTime = lastResult == null ? System.currentTimeMillis() : lastResult.getStartTime();
    Date lastEventDate = new Date(lastEventTime);
    String durationStr = DurationFormatUtils.formatDurationHMS(lastEventTime - firstEventTime);
    
    DBObject testRunObj = getTestService().getTestRunMetadata(test, run);
    
    writer.write("Name:,");
    writer.write(test + "." + run);
    writer.write(NEW_LINE);
    writer.write("Description:,");
    if (testRunObj.get(FIELD_DESCRIPTION) != null)
    {
        writer.write((String) testRunObj.get(FIELD_DESCRIPTION));
    }
    writer.write(NEW_LINE);
    writer.write("Data:,");
    writer.write(resultService.getDataLocation());
    writer.write(NEW_LINE);
    writer.write("Started:,");
    writer.write(firstEventDate.toString());
    writer.write(NEW_LINE);
    writer.write("Finished:,");
    writer.write(lastEventDate.toString());
    writer.write(NEW_LINE);
    writer.write("Duration:,");
    writer.write("'" + durationStr);            // ' is needed for Excel
    writer.write(NEW_LINE);
    writer.write(NEW_LINE);

    writer.write("Notes:");
    writer.write(NEW_LINE);
    writer.write(notes.replace(',', ' '));
    writer.write(NEW_LINE);
    writer.write(NEW_LINE);
}
 
開發者ID:AlfrescoBenchmark,項目名稱:alfresco-benchmark,代碼行數:47,代碼來源:CSVReporter.java

示例6: formatDuration

import org.apache.commons.lang3.time.DurationFormatUtils; //導入方法依賴的package包/類
/**
 * 按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());
}
 
開發者ID:darren-fu,項目名稱:RestyPass,代碼行數:13,代碼來源:DateFormatTools.java

示例7: formatDuration

import org.apache.commons.lang3.time.DurationFormatUtils; //導入方法依賴的package包/類
/**
 * 按HH:mm:ss.SSS格式,格式化時間間隔.
 * 
 * endDate必須大於startDate,間隔可大於1天,
 */
public static String formatDuration(@NotNull Date startDate, @NotNull Date endDate) {
	return DurationFormatUtils.formatDurationHMS(endDate.getTime() - startDate.getTime());
}
 
開發者ID:zhangjunfang,項目名稱:util,代碼行數:9,代碼來源:DateFormatUtil.java


注:本文中的org.apache.commons.lang3.time.DurationFormatUtils.formatDurationHMS方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。