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

Method create_converter

Lib/test/test_time.py:1148–1161  ·  view source on GitHub ↗
(self, sec_to_unit)

Source from the content-addressed store, hash-verified

1146 value_filter=self.time_t_filter)
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):
1164 from _testinternalcapi import _PyTime_ObjectToTimeval

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected