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


##########
python/src/iceberg/utils/datetime.py:
##########
@@ -77,6 +89,12 @@ def timestamptz_to_micros(timestamptz_str: str) -> int:
     raise ValueError(f"Invalid timestamp with zone: {timestamptz_str} (must be 
ISO-8601)")
 
 
+def micros_to_timestamp(micros: int, tzinfo: timezone | None = None):
+    dt = timedelta(microseconds=micros)
+    unix_epoch_datetime = datetime(1970, 1, 1, 0, 0, 0, 0, tzinfo=tzinfo)

Review Comment:
   Can you use `EPOCH_TIMESTAMP` and `EPOCH_TIMESTAMPTZ` instead of creating a 
new `datetime` here?
   
   ```python
   def micros_to_timestamp(micros: int):
       return EPOCH_TIMESTAMP + timedelta(microseconds=micros)
   
   def micros_to_timestamptz(micros: int):
       return EPOCH_TIMESTAMPTZ + timedelta(microseconds=micros)
   ```



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