@@ -21,7 +21,9 @@ cnp.import_array()
2121from .conversion cimport normalize_i8_stamp
2222
2323from .dtypes import Resolution
24+
2425from .ccalendar cimport DAY_NANOS
26+ from .dtypes cimport c_Resolution
2527from .nattype cimport (
2628 NPY_NAT,
2729 c_NaT as NaT,
@@ -168,27 +170,19 @@ def ints_to_pydatetime(
168170
169171# -------------------------------------------------------------------------
170172
171- cdef:
172- int RESO_US = Resolution.RESO_US.value
173- int RESO_MS = Resolution.RESO_MS.value
174- int RESO_SEC = Resolution.RESO_SEC.value
175- int RESO_MIN = Resolution.RESO_MIN.value
176- int RESO_HR = Resolution.RESO_HR.value
177- int RESO_DAY = Resolution.RESO_DAY.value
178-
179173
180- cdef inline int _reso_stamp(npy_datetimestruct * dts):
174+ cdef inline c_Resolution _reso_stamp(npy_datetimestruct * dts):
181175 if dts.us != 0 :
182176 if dts.us % 1000 == 0 :
183- return RESO_MS
184- return RESO_US
177+ return c_Resolution. RESO_MS
178+ return c_Resolution. RESO_US
185179 elif dts.sec != 0 :
186- return RESO_SEC
180+ return c_Resolution. RESO_SEC
187181 elif dts.min != 0 :
188- return RESO_MIN
182+ return c_Resolution. RESO_MIN
189183 elif dts.hour != 0 :
190- return RESO_HR
191- return RESO_DAY
184+ return c_Resolution. RESO_HR
185+ return c_Resolution. RESO_DAY
192186
193187
194188@ cython.wraparound (False )
@@ -205,7 +199,7 @@ def get_resolution(const int64_t[:] stamps, tzinfo tz=None) -> Resolution:
205199 str typ
206200
207201 npy_datetimestruct dts
208- int reso = RESO_DAY, curr_reso
202+ c_Resolution reso = c_Resolution. RESO_DAY, curr_reso
209203
210204 if is_utc(tz ) or tz is None:
211205 use_utc = True
0 commit comments