All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sourceforge.plantuml.stats.HumanDuration Maven / Gradle / Ivy

There is a newer version: 1.2025.0
Show newest version
// THIS FILE HAS BEEN GENERATED BY A PREPROCESSOR.
package net.sourceforge.plantuml.stats;

class HumanDuration {

	private final long duration;

	public HumanDuration(long duration) {
		this.duration = duration;
	}

	@Override
	public String toString() {
		long time = duration;
//		final long ms = time % 1000L;
		time = time / 1000;
		final long sec = time % 60;
		time = time / 60;
		final long min = time % 60;
		time = time / 60;
		final long hour = time % 24;
		final long day = time / 24;
		if (day > 0) {
			return String.format("%dd %02dh%02dm%02ds", day, hour, min, sec);
		}
		if (hour > 0) {
			return String.format("%dh%02dm%02ds", hour, min, sec);
		}
		if (min > 0) {
			return String.format("%dm%02ds", min, sec);
		}
		return String.format("%ds", sec);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy