public static String printDuration(long time) {
        StringBuilder sb = new StringBuilder();
        if (time > 1000 * 60 * 60 * 24 * 2) {
            double days = time / (1000.0 * 60 * 60 * 24);
            sb.append(String.format(Locale.ENGLISH, "%.2f", days)).append(" day").append(Math.abs(days - 1.0) < 0.0001 ? "" : "s");
        } else if (time > 1000 * 60 * 60 * 2) {
            double hours = time / (1000.0 * 60 * 60);
            sb.append(String.format(Locale.ENGLISH, "%.2f", hours)).append(" hour").append(Math.abs(hours - 1.0) < 0.0001 ? "" : "s");
        } else if (time > 1000 * 60 * 2) {
            double minutes = time / (1000.0 * 60);
            sb.append(String.format(Locale.ENGLISH, "%.2f", minutes)).append(" minute").append(Math.abs(minutes - 1.0) < 0.0001 ? "" : "s");
        } else if (time > 1000 * 2) {
            double seconds = time / (1000.0);
            sb.append(String.format(Locale.ENGLISH, "%.2f", seconds)).append(" s");
        } else {
            sb.append(time).append(" ms");
        }
        return sb.toString();
    }
Implementation of timer used when running for real.
clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/RealTimer.java