seconds is not hires enough for the shell commands
This commit is contained in:
parent
d3306f6b1b
commit
4612d3d5bc
|
@ -46,9 +46,19 @@ public class Time extends SigarCommandBase {
|
||||||
return nano / 1000000;
|
return nano / 1000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String format(long t) {
|
private static String format(long elap) {
|
||||||
t /= 1000;
|
String fraction = (elap % 1000) + "";
|
||||||
return t/60 + ":" + t%60;
|
int pad = 3 - fraction.length();
|
||||||
|
|
||||||
|
StringBuffer buf = new StringBuffer()
|
||||||
|
.append(elap / 1000).append('.');
|
||||||
|
|
||||||
|
//for example, 15 millseconds formatted as ".015" rather than ".15"
|
||||||
|
while (pad-- > 0) {
|
||||||
|
buf.append("0");
|
||||||
|
}
|
||||||
|
buf.append(fraction).append(" seconds");
|
||||||
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue