https://www.cnblogs.com/atlas2016/p/7235095.html
对上面网页的转换做了修改,增加每次读到行android time就刷新基础计算时间的功能,保证以上次最近的android time时间为基础。
import time
import datetime
import sys
import getopt
import os
a_time = None
s_second = None
s_microsecond = None
abs_time = 0.0
inputfile = None
outputfile = None
def usage():
print('''Help Information:
-h, --help: Show help information
-i, --inputfile: input file to parse
-o, --outputfile: output file parsed
''')
def calc_delta(stream):
global s_second
global s_microsecond
global a_time
global outfile
begin_index = None
end_index = None
delta_second = 0
delta_mircosecond = 0
delta_time = 0
d_time = None
new_line = None
for line in stream:
if line:
if 'android time' in line:
update_time_reference(line)
try:
begin_index = line.index('[')
end_index = line[begin_index+1:].index(']')+begin_index+1
time_string = line[begin_index + 1