@Override
public TInstance resultInstance(List<TPreptimeValue> inputs, TPreptimeContext context)
{
TPreptimeValue formatArg = inputs.get(1);
ValueSource format = formatArg.value();
int length;
// format is not literal
// the length is format's precision * 10
if (format == null)
length = formatArg.type().attribute(StringAttribute.MAX_LENGTH) * 10;
else
{
ValueSource unixTime = inputs.get(0).value();
// if the unix time value is not literal, get the length
// from the format string
length = computeLength(format.getString());
// if the unix time is available, get the actual length
if (unixTime != null)
{
Object prepObjects[] = computeResult(unixTime.getInt64(),
format.getString(),
context.getCurrentTimezone());
context.set(RET_INDEX, prepObjects[RET_INDEX]);
context.set(ERROR_INDEX, prepObjects[ERROR_INDEX]);