var d = new Date(); var n = d.toString();
var s = d.getTime(); execution.setVariable("elapsedStart", s);
Then in the end listener use:
var d = new Date();
var e = d.getTime();
var s = execution.getVariable("elapsedStart");
var elapsed = e - s;
"elapsed" is your duration.