@@ -21,7 +21,9 @@ cnp.import_array()
21
21
from .conversion cimport normalize_i8_stamp
22
22
23
23
from .dtypes import Resolution
24
+
24
25
from .ccalendar cimport DAY_NANOS
26
+ from .dtypes cimport c_Resolution
25
27
from .nattype cimport (
26
28
NPY_NAT,
27
29
c_NaT as NaT,
@@ -168,27 +170,19 @@ def ints_to_pydatetime(
168
170
169
171
# -------------------------------------------------------------------------
170
172
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
-
179
173
180
- cdef inline int _reso_stamp(npy_datetimestruct * dts):
174
+ cdef inline c_Resolution _reso_stamp(npy_datetimestruct * dts):
181
175
if dts.us != 0 :
182
176
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
185
179
elif dts.sec != 0 :
186
- return RESO_SEC
180
+ return c_Resolution. RESO_SEC
187
181
elif dts.min != 0 :
188
- return RESO_MIN
182
+ return c_Resolution. RESO_MIN
189
183
elif dts.hour != 0 :
190
- return RESO_HR
191
- return RESO_DAY
184
+ return c_Resolution. RESO_HR
185
+ return c_Resolution. RESO_DAY
192
186
193
187
194
188
@ cython.wraparound (False )
@@ -205,7 +199,7 @@ def get_resolution(const int64_t[:] stamps, tzinfo tz=None) -> Resolution:
205
199
str typ
206
200
207
201
npy_datetimestruct dts
208
- int reso = RESO_DAY, curr_reso
202
+ c_Resolution reso = c_Resolution. RESO_DAY, curr_reso
209
203
210
204
if is_utc(tz ) or tz is None:
211
205
use_utc = True
0 commit comments