diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2020-02-11 17:05:53 -0500 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2020-02-11 17:05:53 -0500 |
| commit | f4173c0e8a6b925dc75a9890b56e1e9a146964e9 (patch) | |
| tree | c495706a31d666acf00334a920c39908735ee4b7 | |
| parent | e6d6b15f3d5e8a547c30400acbd77a4207c8671d (diff) | |
| download | pyisda-f4173c0e8a6b925dc75a9890b56e1e9a146964e9.tar.gz | |
faster way of constructing date
| -rw-r--r-- | pyisda/date.pyx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/pyisda/date.pyx b/pyisda/date.pyx index 682fb03..2482fbd 100644 --- a/pyisda/date.pyx +++ b/pyisda/date.pyx @@ -1,5 +1,6 @@ import datetime from cpython cimport datetime as c_datetime +from cpython.datetime cimport date_year, date_month, date_day from cpython.version cimport PY_MAJOR_VERSION from libc.stdlib cimport malloc, free cimport cython @@ -11,7 +12,7 @@ c_datetime.import_datetime() cdef int SUCCESS = 0 cpdef TDate pydate_to_TDate(c_datetime.date d): - return JpmcdsDate(<long>d.year, <long>d.month, <long>d.day) + return JpmcdsDate(date_year(d), date_month(d), date_day(d)) cpdef c_datetime.date TDate_to_pydate(TDate d): cdef TMonthDayYear date |
