Value result = Sequence.EMPTY;
if (arguments[0].getSequence() != Sequence.EMPTY) {
DurationValue duration = context.getFactory().createDurationValue(
arguments[0].stringValue().asJavaString());
DateTimeValue dateTime = CurrentDateTimeHelper
.getCurrentDateTimeValue(context);
DateTimeValue newDateTime = ((SimpleDateTimeValue) dateTime)
.add(duration);
long seconds = (newDateTime.getCalendar().getTimeInMillis() - dateTime
.getCalendar().getTimeInMillis()) / 1000;
result = context.getFactory().createIntValue((int) seconds);
}
return result;
}