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

Method converter

Lib/test/test_time.py:1149–1160  ·  view source on GitHub ↗
(secs)

Source from the content-addressed store, hash-verified

1147
1148 def create_converter(self, sec_to_unit):
1149 def converter(secs):
1150 floatpart, intpart = math.modf(secs)
1151 intpart = int(intpart)
1152 floatpart *= sec_to_unit
1153 floatpart = self.decimal_round(floatpart)
1154 if floatpart < 0:
1155 floatpart += sec_to_unit
1156 intpart -= 1
1157 elif floatpart >= sec_to_unit:
1158 floatpart -= sec_to_unit
1159 intpart += 1
1160 return (intpart, floatpart)
1161 return converter
1162
1163 def test_object_to_timeval(self):

Callers

nothing calls this directly

Calls 1

decimal_roundMethod · 0.80

Tested by

no test coverage detected