set duration in  function