rdblue commented on code in PR #8067:
URL: https://github.com/apache/iceberg/pull/8067#discussion_r1279827274


##########
python/pyiceberg/utils/datetime.py:
##########
@@ -61,15 +61,14 @@ def days_to_date(days: int) -> date:
     return EPOCH_DATE + timedelta(days)
 
 
-def time_to_micros(time_str: str) -> int:
+def time_str_to_micros(time_str: str) -> int:
     """Converts an ISO-8601 formatted time to microseconds from midnight."""
-    t = time.fromisoformat(time_str)
-    return (((t.hour * 60 + t.minute) * 60) + t.second) * 1_000_000 + 
t.microsecond
+    return time_to_micros(time.fromisoformat(time_str))
 
 
-def time_object_to_micros(t: time) -> int:
-    """Converts an datetime.time object to microseconds from midnight."""
-    return int(t.hour * 60 * 60 * 1e6 + t.minute * 60 * 1e6 + t.second * 1e6 + 
t.microsecond)
+def time_to_micros(t: time) -> int:
+    """Converts a datetime.time object to microseconds from midnight."""
+    return int((((t.hour * 60 * 60) + (t.minute * 60) + t.second) * 1e6) + 
t.microsecond)

Review Comment:
   Oh, and IIRC the 1e6 converts the whole expression to float and back. We 
shouldn't do that.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to