Skip to content

Commit 52665c6

Browse files
author
Jonathan Eliashiv
committed
forgot to include a couple type defs and structs
1 parent 98d3e12 commit 52665c6

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

pandas/_libs/tslibs/src/datetime/np_datetime.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,24 @@ npy_int64 extract_unit(npy_datetime *d, npy_datetime unit) {
517517
return div;
518518
}
519519

520+
/* Exported as DATETIMEUNITS in multiarraymodule.c */
521+
char const *_datetime_strings[NPY_DATETIME_NUMUNITS] = {
522+
"Y",
523+
"M",
524+
"W",
525+
"<invalid>",
526+
"D",
527+
"h",
528+
"m",
529+
"s",
530+
"ms",
531+
"us",
532+
"ns",
533+
"ps",
534+
"fs",
535+
"as",
536+
"generic"
537+
};
520538
/*
521539
* Converts a datetime based on the given metadata into a datetimestruct
522540
*/

pandas/_libs/tslibs/src/datetime/np_datetime.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ This file is derived from NumPy 1.7. See NUMPY_LICENSE.txt
2323

2424
#include <numpy/ndarraytypes.h>
2525

26+
extern char const *_datetime_strings[NPY_DATETIME_NUMUNITS];
27+
2628
typedef struct {
2729
npy_int64 days;
2830
npy_int32 hrs, min, sec, ms, us, ns, seconds, microseconds, nanoseconds;

pandas/_libs/tslibs/src/datetime/np_datetime_strings.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,20 @@ This file implements string parsing and creation for NumPy datetime.
3737
#include "np_datetime.h"
3838
#include "np_datetime_strings.h"
3939

40+
/*
41+
* Platform-specific time_t typedef. Some platforms use 32 bit, some use 64 bit
42+
* and we just use the default with the exception of mingw, where we must use
43+
* 64 bit because MSVCRT version 9 does not have the (32 bit) localtime()
44+
* symbol, so we need to use the 64 bit version [1].
45+
*
46+
* [1] http://thread.gmane.org/gmane.comp.gnu.mingw.user/27011
47+
*/
48+
#if defined(NPY_MINGW_USE_CUSTOM_MSVCR)
49+
typedef __time64_t NPY_TIME_T;
50+
#else
51+
typedef time_t NPY_TIME_T;
52+
#endif
53+
4054

4155
/*
4256
* Parses (almost) standard ISO 8601 date strings. The differences are:

0 commit comments

Comments
 (0)