def rt_time_log(logfile, startdate):
if os.name == '<STR_LIT>':<EOL><INDENT>f = io.open(logfile, '<STR_LIT:rb>')<EOL><DEDENT>else:<EOL><INDENT>f = io.open(logfile, '<STR_LIT:rb>')<EOL><DEDENT>phase_err = []<EOL>lock = []<EOL>for line_binary in f:<EOL><INDENT>try:<EOL><INDENT>line = line_binary.decode("<STR_LIT:utf8>", "<STR_LIT:ignore>")<EOL><DEDENT>except UnicodeDecodeError:<EOL><INDENT>warnings.warn('<STR_LIT>')<EOL>continue<EOL><DEDENT>if re.search("<STR_LIT>", line):<EOL><INDENT>match = re.search("<STR_LIT>", line)<EOL>d_start = match.start() - <NUM_LIT><EOL>phase_err.append((dt.datetime.strptime(str(startdate.year) +<EOL>'<STR_LIT::>' +<EOL>line[d_start:d_start + <NUM_LIT:12>],<EOL>'<STR_LIT>'),<EOL>float(line.rstrip().split()[-<NUM_LIT:2>]) *<EOL><NUM_LIT>))<EOL><DEDENT>elif re.search("<STR_LIT>", line):<EOL><INDENT>match = re.search("<STR_LIT>", line)<EOL>d_start = match.start() - <NUM_LIT><EOL>lock.append((dt.datetime.strptime(str(startdate.year) +<EOL>'<STR_LIT::>' + line[d_start:d_start + <NUM_LIT:12>],<EOL>'<STR_LIT>'),<EOL><NUM_LIT>))<EOL><DEDENT><DEDENT>if len(phase_err) == <NUM_LIT:0> and len(lock) > <NUM_LIT:0>:<EOL><INDENT>phase_err = lock<EOL><DEDENT>f.close()<EOL>return phase_err<EOL>
Open and read reftek raw log-file.

Function to open and read a log-file as written by a RefTek RT130
datalogger. The information within is then scanned for timing errors
above the threshold.

:type logfile: str
:param logfile: The logfile to look in
:type startdate: datetime.date
:param startdate: The start of the file as a date - files contain timing \
    and the julian day, but not the year.

:returns: List of tuple of (:class:`datetime.datetime`, float) as time \
    stamps and phase error.