#!/usr/bin/env python3
#
# Determine the duration of a specified test.
#

import datetime
import pscheduler

json = pscheduler.json_load(exit_on_error=True)['spec']

timeout_iso = json.get("timeout", "PT5S")
duration = pscheduler.iso8601_as_timedelta(timeout_iso) \
          + datetime.timedelta(seconds=1)

pscheduler.succeed_json({
    "duration": pscheduler.timedelta_as_iso8601(duration)
})

