jorisvandenbossche commented on code in PR #43537:
URL: https://github.com/apache/arrow/pull/43537#discussion_r1706693526
##########
python/pyarrow/_flight.pyx:
##########
@@ -746,6 +759,24 @@ cdef class FlightEndpoint(_Weakrefable):
return [Location.wrap(location)
for location in self.endpoint.locations]
+ @property
+ def expiration_time(self):
+ cdef:
+ int64_t time_since_epoch
+ const char* UTC = "UTC"
+ shared_ptr[CTimestampType] time_type =
make_shared[CTimestampType](TimeUnit.TimeUnit_NANO, UTC)
+ shared_ptr[CTimestampScalar] shared
+ if self.endpoint.expiration_time.has_value():
+ time_since_epoch = duration_cast[nanoseconds](
+
self.endpoint.expiration_time.value().time_since_epoch()).count()
Review Comment:
We have some existing helpers defined for time point to nanoseconds
conversion:
https://github.com/apache/arrow/blob/b852b720d43547136e39fbcd9773ba11fe625909/python/pyarrow/src/arrow/python/datetime.h#L135
(and similar for the other way around, `TimePoint_from_ns`)
That could maybe be used here? (didn't check in detail if it applies here,
but they are already declared in libarrow_python.pxd, and then the new
chrono.pxd might not be needed)
--
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]