Skip to content

REF: de-duplicate DST tzconversion code #35077

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 46 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
4b8c4fb
REF: implement TZConvertInfo
jbrockmendel Jun 30, 2020
d8bffdd
Merge branch 'master' of https://github.com/pandas-dev/pandas into re…
jbrockmendel Jun 30, 2020
fc1ad75
Merge branch 'master' of https://github.com/pandas-dev/pandas into re…
jbrockmendel Jun 30, 2020
998341e
Merge branch 'master' of https://github.com/pandas-dev/pandas into re…
jbrockmendel Jul 1, 2020
8114413
setup_cache->setup
jbrockmendel Jul 1, 2020
907f9c4
revert
jbrockmendel Jul 1, 2020
addf931
Merge branch 'master' of https://github.com/pandas-dev/pandas into re…
jbrockmendel Jul 1, 2020
b2154d4
Merge branch 'master' of https://github.com/pandas-dev/pandas into re…
jbrockmendel Jul 1, 2020
9bcccc0
Merge branch 'master' of https://github.com/pandas-dev/pandas into re…
jbrockmendel Jul 1, 2020
bb7e60d
ensure initialized
jbrockmendel Jul 1, 2020
407f266
ensure initialized
jbrockmendel Jul 1, 2020
5adca21
debuggina ssertions
jbrockmendel Jul 1, 2020
69bfb80
debuggina ssertions
jbrockmendel Jul 1, 2020
13244c8
debuggina ssertions
jbrockmendel Jul 1, 2020
c0f8b34
debuggina ssertions
jbrockmendel Jul 1, 2020
8620905
debuggina ssertions
jbrockmendel Jul 1, 2020
3605695
debuggina ssertions
jbrockmendel Jul 1, 2020
a0eb787
debuggina ssertions
jbrockmendel Jul 1, 2020
c8fcc19
debuggina ssertions
jbrockmendel Jul 1, 2020
db71af5
debuggina ssertions
jbrockmendel Jul 1, 2020
e47e490
debuggina ssertions
jbrockmendel Jul 1, 2020
7f8c717
debuggina ssertions
jbrockmendel Jul 1, 2020
e21cd6a
debuggina ssertions
jbrockmendel Jul 1, 2020
9a47096
debuggina ssertions
jbrockmendel Jul 1, 2020
d6dce1a
debuggina ssertions
jbrockmendel Jul 1, 2020
0dbd8ac
debuggina ssertions
jbrockmendel Jul 1, 2020
f9514b4
debuggina ssertions
jbrockmendel Jul 2, 2020
e198dbd
debuggina ssertions
jbrockmendel Jul 2, 2020
681f5b8
debuggina ssertions
jbrockmendel Jul 2, 2020
e93b961
debuggina ssertions
jbrockmendel Jul 2, 2020
52af5e1
debuggina ssertions
jbrockmendel Jul 2, 2020
26d0d3a
debuggina ssertions
jbrockmendel Jul 2, 2020
3b220fb
debuggina ssertions
jbrockmendel Jul 2, 2020
3c1bf60
debuggina ssertions
jbrockmendel Jul 2, 2020
a70ce3f
debuggina ssertions
jbrockmendel Jul 2, 2020
2478ec3
debuggina ssertions
jbrockmendel Jul 2, 2020
21cbfc2
debuggina ssertions
jbrockmendel Jul 2, 2020
2aa256a
debuggina ssertions
jbrockmendel Jul 2, 2020
7669dc2
debuggina ssertions
jbrockmendel Jul 2, 2020
2bfb9df
debuggina ssertions
jbrockmendel Jul 2, 2020
3dd2957
CLN
jbrockmendel Jul 2, 2020
b31c40e
debugging assertions
jbrockmendel Jul 2, 2020
8b2e9a3
Merge branch 'master' of https://github.com/pandas-dev/pandas into re…
jbrockmendel Jul 7, 2020
e5b73c7
Implement TZ
jbrockmendel Jul 7, 2020
184e188
implement as cdef class
jbrockmendel Jul 7, 2020
b974ec7
Merge branch 'master' of https://github.com/pandas-dev/pandas into re…
jbrockmendel Jul 7, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pandas/_libs/tslibs/timezones.pxd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from cpython.datetime cimport datetime, timedelta, tzinfo

from numpy cimport int64_t, intp_t, ndarray

cdef tzinfo utc_pytz

cpdef bint is_utc(tzinfo tz)
Expand Down
15 changes: 14 additions & 1 deletion pandas/_libs/tslibs/tzconversion.pxd
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
from cpython.datetime cimport tzinfo
from numpy cimport int64_t
from numpy cimport int64_t, intp_t, ndarray


cdef int64_t tz_convert_utc_to_tzlocal(int64_t utc_val, tzinfo tz, bint* fold=*)
cpdef int64_t tz_convert_single(int64_t val, tzinfo tz1, tzinfo tz2)
cdef int64_t tz_localize_to_utc_single(
int64_t val, tzinfo tz, object ambiguous=*, object nonexistent=*
) except? -1


cdef class Localizer:
cdef:
bint use_utc, use_tzlocal, use_fixed, use_pytz
int noffsets
int64_t* utcoffsets
intp_t* positions
ndarray positions_arr # needed to avoid segfault
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we even need both positions_arr and positions or can we just use the former?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could just use the former, but i think we get a perf boost from indexing on the latter

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can see a difference then sure, but if not would definitely be cleaner to just stick with the ndarray

int64_t delta
tzinfo tz

cdef inline int64_t get_local_timestamp(self, int64_t utc_value, Py_ssize_t i)