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


##########
python/pyiceberg/utils/datetime.py:
##########
@@ -67,6 +67,11 @@ def time_to_micros(time_str: str) -> int:
     return (((t.hour * 60 + t.minute) * 60) + t.second) * 1_000_000 + 
t.microsecond
 
 
+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)

Review Comment:
   I think this should use the same logic as line 67 above. There are a couple 
of good things about that form:
   1. It stays in `int` and doesn't introduce any floating point values. That 
avoids the cast and, more importantly, avoids any floating point math that may 
introduce errors.
   2. It's easier to read and understand that it is correct.



-- 
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