MCPcopy Index your code
hub / github.com/python/cpython / _format_offset

Function _format_offset

Lib/_pydatetime.py:187–203  ·  view source on GitHub ↗
(off, sep=':')

Source from the content-addressed store, hash-verified

185 return fmt.format(hh, mm, ss, us)
186
187def _format_offset(off, sep=':'):
188 s = ''
189 if off is not None:
190 if off.days < 0:
191 sign = "-"
192 off = -off
193 else:
194 sign = "+"
195 hh, mm = divmod(off, timedelta(hours=1))
196 mm, ss = divmod(mm, timedelta(minutes=1))
197 s += "%s%02d%s%02d" % (sign, hh, sep, mm)
198 if ss or ss.microseconds:
199 s += "%s%02d" % (sep, ss.seconds)
200
201 if ss.microseconds:
202 s += '.%06d' % ss.microseconds
203 return s
204
205_normalize_century = None
206def _need_normalize_century():

Callers 3

_wrap_strftimeFunction · 0.85
_tzstrMethod · 0.85
isoformatMethod · 0.85

Calls 1

timedeltaClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…