MCPcopy Create free account
hub / github.com/Syncplay/syncplay / parseTime

Function parseTime

syncplay/utils.py:106–121  ·  view source on GitHub ↗
(timeStr)

Source from the content-addressed store, hash-verified

104
105
106def parseTime(timeStr):
107 if ":" not in timeStr:
108 return float(timeStr)
109 regex = re.compile(constants.PARSE_TIME_REGEX)
110 parts = regex.match(timeStr)
111 if not parts:
112 return
113 parts = parts.groupdict()
114 time_params = {}
115 for (name, param) in parts.items():
116 if param:
117 if name == "miliseconds":
118 time_params["microseconds"] = int(param) * 1000
119 else:
120 time_params[name] = int(param)
121 return datetime.timedelta(**time_params).total_seconds()
122
123
124def formatTime(timeInSeconds, weeksAsTitles=True):

Callers

nothing calls this directly

Calls 1

compileMethod · 0.80

Tested by

no test coverage detected