complete direction function and time function