Skip to content

Commit d1f502f

Browse files
Updated per code review comments
1 parent 371deae commit d1f502f

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

adafruit_datetime.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1284,8 +1284,7 @@ def _fromtimestamp(cls, t, utc, tz):
12841284
A timezone info object may be passed in as well.
12851285
"""
12861286
if isinstance(t, float):
1287-
frac = t - int(t)
1288-
t = int(t)
1287+
frac, t = _math.modf(t)
12891288
us = round(frac * 1e6)
12901289
if us >= 1000000:
12911290
t += 1
@@ -1294,7 +1293,6 @@ def _fromtimestamp(cls, t, utc, tz):
12941293
t -= 1
12951294
us += 1000000
12961295
else:
1297-
frac = 0
12981296
us = 0
12991297

13001298
if utc:

0 commit comments

Comments
 (0)