Here you can find the source of formatRuntime(long runtime)
Parameter | Description |
---|---|
runtime | the runtime |
public static synchronized String formatRuntime(long runtime)
//package com.java2s; /******************************************************************************* * Copyright (c) 2010, 2011 LogSaw project and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/*from w w w . j av a2s . com*/ * LogSaw project committers - initial API and implementation *******************************************************************************/ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static DateFormat runtimeDateFormat = new SimpleDateFormat("D'T'HH:mm:ss"); /** * Returns the given runtime formatted as ISO-8601 string. * @param runtime the runtime * @return the formatted runtime */ public static synchronized String formatRuntime(long runtime) { return decrementDays(runtimeDateFormat.format(new Date(runtime))); } private static String decrementDays(String str) { int idx = str.indexOf('T'); int days = Integer.parseInt(str.substring(0, idx)); return Integer.toString(--days) + str.substring(idx); } }