new duration function