updated time function