当前位置: 首页>>代码示例>>Java>>正文


Java DurationFormatUtils.formatDurationWords方法代码示例

本文整理汇总了Java中org.apache.commons.lang.time.DurationFormatUtils.formatDurationWords方法的典型用法代码示例。如果您正苦于以下问题:Java DurationFormatUtils.formatDurationWords方法的具体用法?Java DurationFormatUtils.formatDurationWords怎么用?Java DurationFormatUtils.formatDurationWords使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang.time.DurationFormatUtils的用法示例。


在下文中一共展示了DurationFormatUtils.formatDurationWords方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: displayStats

import org.apache.commons.lang.time.DurationFormatUtils; //导入方法依赖的package包/类
private void displayStats(long insertedCnt) {
    float percentComplete = (float) insertedCnt / (float) rowCnt;
    long now = System.currentTimeMillis();
    long elapsedTime = now - startTime;
    long timeRemaining = ((long) (((float) (now - startTime)) / percentComplete)) - elapsedTime;
    String elapsedTimeStr = DurationFormatUtils.formatDurationWords(elapsedTime, true, true);
    String timeRemainingStr = DurationFormatUtils.formatDurationWords(timeRemaining, true,
                                                                      true);

    System.out.println("Inserted " + insertedCnt + " rows (" + readyToFindCnt + " readyToFind, "
            + readyToProcessCnt + " readyToProcess, " + readyToPostProcessCnt
            + " readyToPostProcess) in " + elapsedTimeStr + ".  "
            + ((int) (percentComplete * 100)) + " % complete, " + timeRemainingStr
            + " remaining.");
}
 
开发者ID:Hitachi-Data-Systems,项目名称:Open-DM,代码行数:16,代码来源:PopulateDmDb.java

示例2: createLastCheckInTime

import org.apache.commons.lang.time.DurationFormatUtils; //导入方法依赖的package包/类
private String createLastCheckInTime(IModel<NodeDto> nodeModel) {
    NodeDto node = nodeModel.getObject();
    Long time = node.getLastCheckInTime();
    if (time == null || time == 0) {
        return "";
    }

    //todo i18n
    return DurationFormatUtils.formatDurationWords(System.currentTimeMillis() - time, true, true)
            + " ago";
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:12,代码来源:PageTasks.java

示例3: mergeCurrentEvent

import org.apache.commons.lang.time.DurationFormatUtils; //导入方法依赖的package包/类
private SecqMeEventVO mergeCurrentEvent(SecqMeEventVO userLatestEvent,
                                            SecqMeEventVO currentEmergencyEvent,
                                            String currentEmergencyAudioStream,
                                            String base64VideoString,
                                            InputStream videoInputStream,
                                            Boolean triggerNotification)
            throws CoreException {
        myLog.debug("Merging user : " + currentEmergencyEvent.getUserVO().getUserid()
                + " current emergency Event with user latest running Event..");
        // Forming the event Message
        long durationFromLastEvent = userLatestEvent.getStartTime().getTime()
                - currentEmergencyEvent.getStartTime().getTime();
        String durationStr = DurationFormatUtils.formatDurationWords(durationFromLastEvent, true, true);
        EventStatusType eventStatusType = EventStatusType.EMERGENCY;
        String mediaFilePath = null;

        // Remove all the '-' characters
        durationStr = durationStr.replaceAll("-", "");

//        StringBuffer buf = new StringBuffer();
////        buf.append(userLatestEvent.getMessage());
////        buf.append("\n\n");

        String emergencyMsg = "Received emergency request from user, ";
        if (currentEmergencyAudioStream != null) {
            emergencyMsg = "Received emergency voice message from user, ";
            eventStatusType = EventStatusType.EMERGENCY_AUDIO;
        } else if (base64VideoString != null) {
            emergencyMsg = "Received emergency video from user, ";
            eventStatusType = EventStatusType.EMERGENCY_VIDEO;
        }

//        emergencyMsg = emergencyMsg + durationStr + " after WatchOverMe request submitted";

//        buf.append(emergencyMsg);
//        buf.append(durationStr);
//        buf.append(" after Watch Over Me request submitted.");
//        userLatestEvent.setMessage(buf.toString());
        userLatestEvent.setEventType(currentEmergencyEvent.getEventType());
        userLatestEvent.setEmergencyTriggerAt(new Date());

        //process to notify to user's contact
        if (triggerNotification == null || triggerNotification) {
            processEmergencyEvent(userLatestEvent);
        }

        MediaFileType mediaFileType = null;
        String encodedMediaFile = null;
        if (base64VideoString != null) {
            mediaFileType = MediaFileType.VIDEO;
            encodedMediaFile = base64VideoString;
            userLatestEvent.setEnableVideo(true);
        } else if (currentEmergencyAudioStream != null) {
            mediaFileType = MediaFileType.AUDIO;
            encodedMediaFile = currentEmergencyAudioStream;
            userLatestEvent.setEnableAudio(true);
        }

        if (videoInputStream != null) {
            userLatestEvent.setEnableVideo(true);
            insertEventLogRecord(userLatestEvent, eventStatusType, emergencyMsg, null, null, null, MediaFileType.VIDEO, videoInputStream);
        } else if (encodedMediaFile != null) {
            insertEventLogRecord(userLatestEvent, eventStatusType, emergencyMsg, null, null, null, mediaFileType, encodedMediaFile);
        } else {
            insertEventLogRecord(userLatestEvent, eventStatusType, emergencyMsg, null, null, null);
        }

        getSecqMeEventDAO().update(userLatestEvent);

        return userLatestEvent;
    }
 
开发者ID:SECQME,项目名称:watchoverme-server,代码行数:72,代码来源:DefaultEventManager.java

示例4: getDuration

import org.apache.commons.lang.time.DurationFormatUtils; //导入方法依赖的package包/类
private String getDuration(long milliseconds) {
    return DurationFormatUtils.formatDurationWords(milliseconds, true, true);
}
 
开发者ID:lodms,项目名称:lodms-core,代码行数:4,代码来源:ErrorReportingView.java

示例5: format

import org.apache.commons.lang.time.DurationFormatUtils; //导入方法依赖的package包/类
public static String format(long time) {
    // Round up to the nearest second.
    time += 20 - (time % 20);
    return DurationFormatUtils.formatDurationWords(time * 50, true, true);
}
 
开发者ID:cybertiger,项目名称:Bukkit-Instances,代码行数:6,代码来源:TimeUtil.java

示例6: formatDuration

import org.apache.commons.lang.time.DurationFormatUtils; //导入方法依赖的package包/类
/**
 * Pretty formating of a duration in milliseconds.
 * <p/>
 * @param ms Milliseconds
 * @return Pretty format of the duration
 */
public static String formatDuration(Long ms) {
    return DurationFormatUtils.formatDurationWords(ms, true, true);
}
 
开发者ID:getconverge,项目名称:converge-1.x,代码行数:10,代码来源:DurationFunctions.java


注:本文中的org.apache.commons.lang.time.DurationFormatUtils.formatDurationWords方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。