本文整理匯總了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;
}
示例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() );
}
示例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);
}
示例4: formatMillis
import org.apache.commons.lang3.time.DurationFormatUtils; //導入方法依賴的package包/類
private String formatMillis(double millis)
{
return DurationFormatUtils.formatDurationHMS((Double.valueOf(Math.abs(millis))).longValue());
}
示例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);
}
示例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());
}
示例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());
}