MCPcopy Create free account
hub / github.com/apache/httpd / _parse_tsp

Method _parse_tsp

test/modules/md/md_cert_util.py:179–190  ·  view source on GitHub ↗
(self, tsp)

Source from the content-addressed store, hash-verified

177 return s.decode('utf-8')
178
179 def _parse_tsp(self, tsp):
180 # timestampss returned by PyOpenSSL are bytes
181 # parse date and time part
182 s = ("%s-%s-%s %s:%s:%s" % (self.astr(tsp[0:4]), self.astr(tsp[4:6]), self.astr(tsp[6:8]),
183 self.astr(tsp[8:10]), self.astr(tsp[10:12]), self.astr(tsp[12:14])))
184 timestamp = datetime.strptime(s, '%Y-%m-%d %H:%M:%S')
185 # adjust timezone
186 tz_h, tz_m = 0, 0
187 m = re.match(r"([+\-]\d{2})(\d{2})", self.astr(tsp[14:]))
188 if m:
189 tz_h, tz_m = int(m.group(1)), int(m.group(2)) if tz_h > 0 else -1 * int(m.group(2))
190 return timestamp.replace(tzinfo=self.FixedOffset(60 * tz_h + tz_m))
191
192 @classmethod
193 def _load_binary_file(cls, path):

Callers 2

get_not_beforeMethod · 0.95
get_not_afterMethod · 0.95

Calls 1

astrMethod · 0.95

Tested by

no test coverage detected