Add CommandResult.completionTime field and set it in RuffyScripter when the command has finished executing.
This commit is contained in:
parent
97733848e7
commit
1cf6448b0e
2 changed files with 11 additions and 0 deletions
|
@ -220,6 +220,7 @@ public class RuffyScripter {
|
|||
long cmdStartTime = System.currentTimeMillis();
|
||||
returnable.cmdResult = cmd.execute(scripter, pumpState);
|
||||
long cmdEndTime = System.currentTimeMillis();
|
||||
returnable.cmdResult.completionTime = cmdEndTime;
|
||||
log.debug("Executing " + cmd + " took " + (cmdEndTime - cmdStartTime) + "ms");
|
||||
} catch (CommandException e) {
|
||||
returnable.cmdResult = e.toCommandResult();
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
package de.jotomo.ruffyscripter.commands;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import de.jotomo.ruffyscripter.History;
|
||||
import de.jotomo.ruffyscripter.PumpState;
|
||||
|
||||
public class CommandResult {
|
||||
public boolean success;
|
||||
public boolean enacted;
|
||||
// TODO not really happy with that name "time the command finished executing"
|
||||
public long completionTime;
|
||||
public Exception exception;
|
||||
public String message;
|
||||
public PumpState state;
|
||||
|
@ -24,6 +28,11 @@ public class CommandResult {
|
|||
return this;
|
||||
}
|
||||
|
||||
public CommandResult completionTime(long completionTime) {
|
||||
this.completionTime = completionTime ;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CommandResult exception(Exception exception) {
|
||||
this.exception = exception;
|
||||
return this;
|
||||
|
@ -49,6 +58,7 @@ public class CommandResult {
|
|||
return "CommandResult{" +
|
||||
"success=" + success +
|
||||
", enacted=" + enacted +
|
||||
", completienTime=" + completionTime + "(" + new Date(completionTime) + ")" +
|
||||
", exception=" + exception +
|
||||
", message='" + message + '\'' +
|
||||
", state=" + state +
|
||||
|
|
Loading…
Reference in a new issue