Show More
@@ -1076,22 +1076,6 b' def parse_breakpoint(text, current_file):' | |||||
1076 | def _format_time(timespan, precision=3): |
|
1076 | def _format_time(timespan, precision=3): | |
1077 | """Formats the timespan in a human readable form""" |
|
1077 | """Formats the timespan in a human readable form""" | |
1078 | import math |
|
1078 | import math | |
1079 | # XXX: Unfortunately the unicode 'micro' symbol can cause problems in |
|
|||
1080 | # certain terminals. |
|
|||
1081 | # See bug: https://bugs.launchpad.net/ipython/+bug/348466 |
|
|||
1082 |
|
||||
1083 | # This is trying to prevent crashes, so it's more secure than it needs to |
|
|||
1084 | # E.g. eclipse is able to print a µ, but has no sys.stdout.encoding set. |
|
|||
1085 |
|
||||
1086 |
|
||||
1087 | units = [u"s", u"ms",u'us',"ns"] # the save value |
|
|||
1088 | if hasattr(sys.stdout, 'encoding') and sys.stdout.encoding: |
|
|||
1089 | try: |
|
|||
1090 | u'\xb5'.encode(sys.stdout.encoding) |
|
|||
1091 | units = [u"s", u"ms",u'\xb5s',"ns"] |
|
|||
1092 | except: |
|
|||
1093 | pass |
|
|||
1094 | scaling = [1, 1e3, 1e6, 1e9] |
|
|||
1095 |
|
1079 | |||
1096 | if timespan >= 60.0: |
|
1080 | if timespan >= 60.0: | |
1097 | # we have more than a minute, format that in a human readable form |
|
1081 | # we have more than a minute, format that in a human readable form | |
@@ -1107,7 +1091,22 b' def _format_time(timespan, precision=3):' | |||||
1107 | if leftover < 1: |
|
1091 | if leftover < 1: | |
1108 | break |
|
1092 | break | |
1109 | return " ".join(time) |
|
1093 | return " ".join(time) | |
|
1094 | ||||
1110 |
|
1095 | |||
|
1096 | # Unfortunately the unicode 'micro' symbol can cause problems in | |||
|
1097 | # certain terminals. | |||
|
1098 | # See bug: https://bugs.launchpad.net/ipython/+bug/348466 | |||
|
1099 | # Try to prevent crashes by being more secure than it needs to | |||
|
1100 | # E.g. eclipse is able to print a µ, but has no sys.stdout.encoding set. | |||
|
1101 | units = [u"s", u"ms",u'us',"ns"] # the save value | |||
|
1102 | if hasattr(sys.stdout, 'encoding') and sys.stdout.encoding: | |||
|
1103 | try: | |||
|
1104 | u'\xb5'.encode(sys.stdout.encoding) | |||
|
1105 | units = [u"s", u"ms",u'\xb5s',"ns"] | |||
|
1106 | except: | |||
|
1107 | pass | |||
|
1108 | scaling = [1, 1e3, 1e6, 1e9] | |||
|
1109 | ||||
1111 | if timespan > 0.0: |
|
1110 | if timespan > 0.0: | |
1112 | order = min(-int(math.floor(math.log10(timespan)) // 3), 3) |
|
1111 | order = min(-int(math.floor(math.log10(timespan)) // 3), 3) | |
1113 | else: |
|
1112 | else: |
General Comments 0
You need to be logged in to leave comments.
Login now