diff --git a/cpp/src/arrow/flight/types.h b/cpp/src/arrow/flight/types.h index b6309d0af2a71..ba1ed818d8552 100644 --- a/cpp/src/arrow/flight/types.h +++ b/cpp/src/arrow/flight/types.h @@ -80,7 +80,7 @@ class FlightServerBase; /// > all minutes are 60 seconds long, i.e. leap seconds are "smeared" /// > so that no leap second table is needed for interpretation. Range /// > is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. -using Timestamp = std::chrono::system_clock::time_point; +using Timestamp = std::chrono::time_point; /// \brief A Flight-specific status code. Used to encode some /// additional status codes into an Arrow Status. diff --git a/python/pyarrow/_flight.pyx b/python/pyarrow/_flight.pyx index ba6cdf273ac22..41115b293e970 100644 --- a/python/pyarrow/_flight.pyx +++ b/python/pyarrow/_flight.pyx @@ -750,11 +750,7 @@ cdef class FlightEndpoint(_Weakrefable): if expiration_time is not None: if isinstance(expiration_time, lib.TimestampScalar): - # Convert into OS-dependent std::chrono::system_clock::time_point from - # std::chrono::time_point - # See Timestamp in cpp/src/arrow/flight/types.h - self.endpoint.expiration_time = TimePoint_to_system_time(TimePoint_from_ns( - expiration_time.cast(timestamp("ns")).value)) + self.endpoint.expiration_time = TimePoint_from_ns(expiration_time.cast(timestamp("ns")).value) else: raise TypeError("Argument expiration_time must be a TimestampScalar, " "not '{}'".format(type(expiration_time))) @@ -786,11 +782,7 @@ cdef class FlightEndpoint(_Weakrefable): cdef: int64_t time_since_epoch if self.endpoint.expiration_time.has_value(): - time_since_epoch = TimePoint_to_ns( - # Convert from OS-dependent std::chrono::system_clock::time_point into - # std::chrono::time_point - # See Timestamp in cpp/src/arrow/flight/types.h - TimePoint_from_system_time(self.endpoint.expiration_time.value())) + time_since_epoch = TimePoint_to_ns(self.endpoint.expiration_time.value()) return lib.scalar(time_since_epoch, timestamp("ns", "UTC")) return None diff --git a/python/pyarrow/includes/chrono.pxd b/python/pyarrow/includes/chrono.pxd deleted file mode 100644 index e5d22d19751d7..0000000000000 --- a/python/pyarrow/includes/chrono.pxd +++ /dev/null @@ -1,23 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# distutils: language = c++ - - -cdef extern from "" namespace "std::chrono::system_clock": - cdef cppclass time_point: - pass diff --git a/python/pyarrow/includes/libarrow_flight.pxd b/python/pyarrow/includes/libarrow_flight.pxd index d2bc3c9d0da23..3e9c3d9aede71 100644 --- a/python/pyarrow/includes/libarrow_flight.pxd +++ b/python/pyarrow/includes/libarrow_flight.pxd @@ -19,8 +19,7 @@ from pyarrow.includes.common cimport * from pyarrow.includes.libarrow cimport * -from pyarrow.includes.chrono cimport time_point - +from pyarrow.includes.libarrow_python cimport CTimePoint cdef extern from "arrow/flight/api.h" namespace "arrow" nogil: cdef char* CTracingServerMiddlewareName\ @@ -135,7 +134,7 @@ cdef extern from "arrow/flight/api.h" namespace "arrow" nogil: CTicket ticket vector[CLocation] locations - optional[time_point] expiration_time + optional[CTimePoint] expiration_time c_string app_metadata bint operator==(CFlightEndpoint) diff --git a/python/pyarrow/includes/libarrow_python.pxd b/python/pyarrow/includes/libarrow_python.pxd index da5bca5edd584..96725c9c3862b 100644 --- a/python/pyarrow/includes/libarrow_python.pxd +++ b/python/pyarrow/includes/libarrow_python.pxd @@ -17,7 +17,6 @@ # distutils: language = c++ -from pyarrow.includes.chrono cimport time_point from pyarrow.includes.common cimport * from pyarrow.includes.libarrow cimport * @@ -245,9 +244,6 @@ cdef extern from "arrow/python/api.h" namespace "arrow::py::internal" nogil: CTimePoint TimePoint_from_s(double val) CTimePoint TimePoint_from_ns(int64_t val) - CTimePoint TimePoint_from_system_time(time_point val) - time_point TimePoint_to_system_time(CTimePoint val) - CResult[c_string] TzinfoToString(PyObject* pytzinfo) CResult[PyObject*] StringToTzinfo(c_string) diff --git a/python/pyarrow/src/arrow/python/datetime.h b/python/pyarrow/src/arrow/python/datetime.h index 3de5ea69fd9da..9b21eeb434217 100644 --- a/python/pyarrow/src/arrow/python/datetime.h +++ b/python/pyarrow/src/arrow/python/datetime.h @@ -144,20 +144,6 @@ inline TimePoint TimePoint_from_ns(int64_t val) { return TimePoint(TimePoint::duration(val)); } -ARROW_PYTHON_EXPORT -// Note: Needed by FlightEndpoint.expiration_time, which is an OS-dependent -// std::chrono::system_clock::time_point -inline std::chrono::system_clock::time_point TimePoint_to_system_time(TimePoint val) { - return std::chrono::time_point_cast(val); -} - -ARROW_PYTHON_EXPORT -// Note: Needed by FlightEndpoint.expiration_time, which is an OS-dependent -// std::chrono::system_clock::time_point -inline TimePoint TimePoint_from_system_time(std::chrono::system_clock::time_point val) { - return std::chrono::time_point_cast(val); -} - ARROW_PYTHON_EXPORT inline int64_t PyDelta_to_s(PyDateTime_Delta* pytimedelta) { return (PyDateTime_DELTA_GET_DAYS(pytimedelta) * 86400LL +