@staticmethod<EOL><INDENT>def bgp_time_conversion(bgp_uptime):<DEDENT>
bgp_uptime = bgp_uptime.strip()<EOL>uptime_letters = set(["<STR_LIT:w>", "<STR_LIT:h>", "<STR_LIT:d>"])<EOL>if "<STR_LIT>" in bgp_uptime:<EOL><INDENT>return -<NUM_LIT:1><EOL><DEDENT>elif "<STR_LIT::>" in bgp_uptime:<EOL><INDENT>times = bgp_uptime.split("<STR_LIT::>")<EOL>times = [int(x) for x in times]<EOL>hours, minutes, seconds = times<EOL>return (hours * <NUM_LIT>) + (minutes * <NUM_LIT>) + seconds<EOL><DEDENT>elif uptime_letters & set(bgp_uptime):<EOL><INDENT>form1 = r"<STR_LIT>"  <EOL>form2 = r"<STR_LIT>"  <EOL>form3 = r"<STR_LIT>"  <EOL>match = re.search(form1, bgp_uptime)<EOL>if match:<EOL><INDENT>days = int(match.group(<NUM_LIT:1>))<EOL>hours = int(match.group(<NUM_LIT:2>))<EOL>return (days * DAY_SECONDS) + (hours * <NUM_LIT>)<EOL><DEDENT>match = re.search(form2, bgp_uptime)<EOL>if match:<EOL><INDENT>weeks = int(match.group(<NUM_LIT:1>))<EOL>days = int(match.group(<NUM_LIT:2>))<EOL>return (weeks * WEEK_SECONDS) + (days * DAY_SECONDS)<EOL><DEDENT>match = re.search(form3, bgp_uptime)<EOL>if match:<EOL><INDENT>years = int(match.group(<NUM_LIT:1>))<EOL>weeks = int(match.group(<NUM_LIT:2>))<EOL>return (years * YEAR_SECONDS) + (weeks * WEEK_SECONDS)<EOL><DEDENT><DEDENT>raise ValueError(<EOL>"<STR_LIT>".format(bgp_uptime)<EOL>)<EOL>
Convert string time to seconds.

Examples
00:14:23
00:13:40
00:00:21
00:00:13
00:00:49
1d11h
1d17h
1w0d
8w5d
1y28w
never