package net.hyperic.sigar.cmd;

import net.hyperic.sigar.Sigar;
import net.hyperic.sigar.SigarException;

public class Time extends SigarCommandBase {

    public Time(Shell shell) {
        super(shell);
    }

    public Time() {
        super();
    }

    protected boolean validateArgs(String[] args) {
        return args.length >= 1;
    }

    public String getSyntaxArgs() {
        return "[command] [...]";
    }

    public String getUsageShort() {
        return "Time command";
    }

    public void output(String[] args) throws SigarException {
        this.shell.handleCommand("time " + args[0], args);
    }

    public static void main(String[] args) throws Exception {
        new Time().processCommand(args);
    }
}

@@ -97,16 +97,52 @@
 ception;
+%0Aimport net.hyperic.sigar.ThreadCpu;
 %0A%0Apublic
@@ -602,57 +602,583 @@
     
-this.shell.handleCommand(%22time %22 + args%5B0%5D, args)
+ThreadCpu cpu = new ThreadCpu();%0A        long start = System.currentTimeMillis();%0A%0A        this.shell.handleCommand(%22time %22 + args%5B0%5D, args);%0A%0A        cpu.gather(this.sigar, 0);%0A        System.out.println(%22real.....%22 +%0A                           (System.currentTimeMillis() - start) / 1000);%0A        System.out.println(%22user.....%22 + toMillis(cpu.getUser()));%0A        System.out.println(%22sys......%22 + toMillis(cpu.getSys()));%0A        System.out.println(%22total....%22 + toMillis(cpu.getTotal()));%0A    %7D%0A%0A    private static long toMillis(long nano) %7B%0A        return nano / 1000000
 ;%0A  

print times