Fixed broken time function