| 180 | return fmt.format(hh, mm, ss, us) |
| 181 | |
| 182 | def _format_offset(off): |
| 183 | s = '' |
| 184 | if off is not None: |
| 185 | if off.days < 0: |
| 186 | sign = "-" |
| 187 | off = -off |
| 188 | else: |
| 189 | sign = "+" |
| 190 | hh, mm = divmod(off, timedelta(hours=1)) |
| 191 | mm, ss = divmod(mm, timedelta(minutes=1)) |
| 192 | s += "%s%02d:%02d" % (sign, hh, mm) |
| 193 | if ss or ss.microseconds: |
| 194 | s += ":%02d" % ss.seconds |
| 195 | |
| 196 | if ss.microseconds: |
| 197 | s += '.%06d' % ss.microseconds |
| 198 | return s |
| 199 | |
| 200 | # Correctly substitute for %z and %Z escapes in strftime formats. |
| 201 | def _wrap_strftime(object, format, timetuple): |