get duration, fix bugs.

N/A

Signed-off-by: achaly <achaly@163.com>