Fixed javascript time function.