annotate Include/datetime.h @ 39042:c02fa187e0f4 legacy-trunk

Part of SF patch #1484695. This removes dead code. The chksum was already verified in .frombuf() on the lines above. If there was a problem an exception is raised, so there was no way this condition could have been true.
author Neal Norwitz <nnorwitz@gmail.com>
date Mon, 10 Jul 2006 00:23:17 +0000
parents 1c69f909c5a6
children e70cdce0e8b2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26673
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
1 /* datetime.h
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
2 */
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
3
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
4 #ifndef DATETIME_H
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
5 #define DATETIME_H
32393
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
6 #ifdef __cplusplus
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
7 extern "C" {
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
8 #endif
26673
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
9
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
10 /* Fields are packed into successive bytes, each viewed as unsigned and
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
11 * big-endian, unless otherwise noted:
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
12 *
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
13 * byte offset
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
14 * 0 year 2 bytes, 1-9999
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
15 * 2 month 1 byte, 1-12
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
16 * 3 day 1 byte, 1-31
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
17 * 4 hour 1 byte, 0-23
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
18 * 5 minute 1 byte, 0-59
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
19 * 6 second 1 byte, 0-59
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
20 * 7 usecond 3 bytes, 0-999999
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
21 * 10
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
22 */
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
23
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
24 /* # of bytes for year, month, and day. */
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
25 #define _PyDateTime_DATE_DATASIZE 4
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
26
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
27 /* # of bytes for hour, minute, second, and usecond. */
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
28 #define _PyDateTime_TIME_DATASIZE 6
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
29
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
30 /* # of bytes for year, month, day, hour, minute, second, and usecond. */
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
31 #define _PyDateTime_DATETIME_DATASIZE 10
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
32
27217
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
33
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
34 typedef struct
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
35 {
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
36 PyObject_HEAD
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
37 long hashcode; /* -1 when unknown */
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
38 int days; /* -MAX_DELTA_DAYS <= days <= MAX_DELTA_DAYS */
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
39 int seconds; /* 0 <= seconds < 24*3600 is invariant */
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
40 int microseconds; /* 0 <= microseconds < 1000000 is invariant */
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
41 } PyDateTime_Delta;
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
42
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
43 typedef struct
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
44 {
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
45 PyObject_HEAD /* a pure abstract base clase */
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
46 } PyDateTime_TZInfo;
27195
65dc0110a735 Got rid of the timetz type entirely. This was a bit trickier than I
Tim Peters <tim.peters@gmail.com>
parents: 26673
diff changeset
47
27217
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
48
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
49 /* The datetime and time types have hashcodes, and an optional tzinfo member,
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
50 * present if and only if hastzinfo is true.
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
51 */
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
52 #define _PyTZINFO_HEAD \
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
53 PyObject_HEAD \
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
54 long hashcode; \
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
55 char hastzinfo; /* boolean flag */
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
56
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
57 /* No _PyDateTime_BaseTZInfo is allocated; it's just to have something
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
58 * convenient to cast to, when getting at the hastzinfo member of objects
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
59 * starting with _PyTZINFO_HEAD.
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
60 */
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
61 typedef struct
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
62 {
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
63 _PyTZINFO_HEAD
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
64 } _PyDateTime_BaseTZInfo;
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
65
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
66 /* All time objects are of PyDateTime_TimeType, but that can be allocated
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
67 * in two ways, with or without a tzinfo member. Without is the same as
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
68 * tzinfo == None, but consumes less memory. _PyDateTime_BaseTime is an
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
69 * internal struct used to allocate the right amount of space for the
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
70 * "without" case.
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
71 */
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
72 #define _PyDateTime_TIMEHEAD \
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
73 _PyTZINFO_HEAD \
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
74 unsigned char data[_PyDateTime_TIME_DATASIZE];
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
75
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
76 typedef struct
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
77 {
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
78 _PyDateTime_TIMEHEAD
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
79 } _PyDateTime_BaseTime; /* hastzinfo false */
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
80
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
81 typedef struct
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
82 {
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
83 _PyDateTime_TIMEHEAD
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
84 PyObject *tzinfo;
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
85 } PyDateTime_Time; /* hastzinfo true */
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
86
27218
38d2238c795e Got rid of the internal datetimetz type.
Tim Peters <tim.peters@gmail.com>
parents: 27217
diff changeset
87
38d2238c795e Got rid of the internal datetimetz type.
Tim Peters <tim.peters@gmail.com>
parents: 27217
diff changeset
88 /* All datetime objects are of PyDateTime_DateTimeType, but that can be
38d2238c795e Got rid of the internal datetimetz type.
Tim Peters <tim.peters@gmail.com>
parents: 27217
diff changeset
89 * allocated in two ways too, just like for time objects above. In addition,
38d2238c795e Got rid of the internal datetimetz type.
Tim Peters <tim.peters@gmail.com>
parents: 27217
diff changeset
90 * the plain date type is a base class for datetime, so it must also have
38d2238c795e Got rid of the internal datetimetz type.
Tim Peters <tim.peters@gmail.com>
parents: 27217
diff changeset
91 * a hastzinfo member (although it's unused there).
38d2238c795e Got rid of the internal datetimetz type.
Tim Peters <tim.peters@gmail.com>
parents: 27217
diff changeset
92 */
38d2238c795e Got rid of the internal datetimetz type.
Tim Peters <tim.peters@gmail.com>
parents: 27217
diff changeset
93 typedef struct
38d2238c795e Got rid of the internal datetimetz type.
Tim Peters <tim.peters@gmail.com>
parents: 27217
diff changeset
94 {
38d2238c795e Got rid of the internal datetimetz type.
Tim Peters <tim.peters@gmail.com>
parents: 27217
diff changeset
95 _PyTZINFO_HEAD
38d2238c795e Got rid of the internal datetimetz type.
Tim Peters <tim.peters@gmail.com>
parents: 27217
diff changeset
96 unsigned char data[_PyDateTime_DATE_DATASIZE];
38d2238c795e Got rid of the internal datetimetz type.
Tim Peters <tim.peters@gmail.com>
parents: 27217
diff changeset
97 } PyDateTime_Date;
38d2238c795e Got rid of the internal datetimetz type.
Tim Peters <tim.peters@gmail.com>
parents: 27217
diff changeset
98
38d2238c795e Got rid of the internal datetimetz type.
Tim Peters <tim.peters@gmail.com>
parents: 27217
diff changeset
99 #define _PyDateTime_DATETIMEHEAD \
38d2238c795e Got rid of the internal datetimetz type.
Tim Peters <tim.peters@gmail.com>
parents: 27217
diff changeset
100 _PyTZINFO_HEAD \
38d2238c795e Got rid of the internal datetimetz type.
Tim Peters <tim.peters@gmail.com>
parents: 27217
diff changeset
101 unsigned char data[_PyDateTime_DATETIME_DATASIZE];
27217
10b7e60245b5 Minor fiddling to make the next part easier. Introduced an internal
Tim Peters <tim.peters@gmail.com>
parents: 27195
diff changeset
102
26673
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
103 typedef struct
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
104 {
27218
38d2238c795e Got rid of the internal datetimetz type.
Tim Peters <tim.peters@gmail.com>
parents: 27217
diff changeset
105 _PyDateTime_DATETIMEHEAD
38d2238c795e Got rid of the internal datetimetz type.
Tim Peters <tim.peters@gmail.com>
parents: 27217
diff changeset
106 } _PyDateTime_BaseDateTime; /* hastzinfo false */
26673
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
107
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
108 typedef struct
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
109 {
27218
38d2238c795e Got rid of the internal datetimetz type.
Tim Peters <tim.peters@gmail.com>
parents: 27217
diff changeset
110 _PyDateTime_DATETIMEHEAD
26673
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
111 PyObject *tzinfo;
27218
38d2238c795e Got rid of the internal datetimetz type.
Tim Peters <tim.peters@gmail.com>
parents: 27217
diff changeset
112 } PyDateTime_DateTime; /* hastzinfo true */
26673
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
113
27195
65dc0110a735 Got rid of the timetz type entirely. This was a bit trickier than I
Tim Peters <tim.peters@gmail.com>
parents: 26673
diff changeset
114
27218
38d2238c795e Got rid of the internal datetimetz type.
Tim Peters <tim.peters@gmail.com>
parents: 27217
diff changeset
115 /* Apply for date and datetime instances. */
26673
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
116 #define PyDateTime_GET_YEAR(o) ((((PyDateTime_Date*)o)->data[0] << 8) | \
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
117 ((PyDateTime_Date*)o)->data[1])
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
118 #define PyDateTime_GET_MONTH(o) (((PyDateTime_Date*)o)->data[2])
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
119 #define PyDateTime_GET_DAY(o) (((PyDateTime_Date*)o)->data[3])
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
120
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
121 #define PyDateTime_DATE_GET_HOUR(o) (((PyDateTime_DateTime*)o)->data[4])
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
122 #define PyDateTime_DATE_GET_MINUTE(o) (((PyDateTime_DateTime*)o)->data[5])
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
123 #define PyDateTime_DATE_GET_SECOND(o) (((PyDateTime_DateTime*)o)->data[6])
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
124 #define PyDateTime_DATE_GET_MICROSECOND(o) \
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
125 ((((PyDateTime_DateTime*)o)->data[7] << 16) | \
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
126 (((PyDateTime_DateTime*)o)->data[8] << 8) | \
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
127 ((PyDateTime_DateTime*)o)->data[9])
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
128
27195
65dc0110a735 Got rid of the timetz type entirely. This was a bit trickier than I
Tim Peters <tim.peters@gmail.com>
parents: 26673
diff changeset
129 /* Apply for time instances. */
26673
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
130 #define PyDateTime_TIME_GET_HOUR(o) (((PyDateTime_Time*)o)->data[0])
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
131 #define PyDateTime_TIME_GET_MINUTE(o) (((PyDateTime_Time*)o)->data[1])
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
132 #define PyDateTime_TIME_GET_SECOND(o) (((PyDateTime_Time*)o)->data[2])
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
133 #define PyDateTime_TIME_GET_MICROSECOND(o) \
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
134 ((((PyDateTime_Time*)o)->data[3] << 16) | \
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
135 (((PyDateTime_Time*)o)->data[4] << 8) | \
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
136 ((PyDateTime_Time*)o)->data[5])
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
137
32393
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
138
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
139 /* Define structure for C API. */
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
140 typedef struct {
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
141 /* type objects */
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
142 PyTypeObject *DateType;
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
143 PyTypeObject *DateTimeType;
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
144 PyTypeObject *TimeType;
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
145 PyTypeObject *DeltaType;
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
146 PyTypeObject *TZInfoType;
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
147
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
148 /* constructors */
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
149 PyObject *(*Date_FromDate)(int, int, int, PyTypeObject*);
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
150 PyObject *(*DateTime_FromDateAndTime)(int, int, int, int, int, int, int,
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
151 PyObject*, PyTypeObject*);
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
152 PyObject *(*Time_FromTime)(int, int, int, int, PyObject*, PyTypeObject*);
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
153 PyObject *(*Delta_FromDelta)(int, int, int, int, PyTypeObject*);
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
154
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
155 /* constructors for the DB API */
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
156 PyObject *(*DateTime_FromTimestamp)(PyObject*, PyObject*, PyObject*);
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
157 PyObject *(*Date_FromTimestamp)(PyObject*, PyObject*);
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
158
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
159 } PyDateTime_CAPI;
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
160
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
161
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
162 /* "magic" constant used to partially protect against developer mistakes. */
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
163 #define DATETIME_API_MAGIC 0x414548d5
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
164
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
165 #ifdef Py_BUILD_CORE
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
166
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
167 /* Macros for type checking when building the Python core. */
26673
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
168 #define PyDate_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateType)
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
169 #define PyDate_CheckExact(op) ((op)->ob_type == &PyDateTime_DateType)
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
170
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
171 #define PyDateTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateTimeType)
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
172 #define PyDateTime_CheckExact(op) ((op)->ob_type == &PyDateTime_DateTimeType)
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
173
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
174 #define PyTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_TimeType)
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
175 #define PyTime_CheckExact(op) ((op)->ob_type == &PyDateTime_TimeType)
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
176
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
177 #define PyDelta_Check(op) PyObject_TypeCheck(op, &PyDateTime_DeltaType)
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
178 #define PyDelta_CheckExact(op) ((op)->ob_type == &PyDateTime_DeltaType)
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
179
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
180 #define PyTZInfo_Check(op) PyObject_TypeCheck(op, &PyDateTime_TZInfoType)
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
181 #define PyTZInfo_CheckExact(op) ((op)->ob_type == &PyDateTime_TZInfoType)
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
182
32393
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
183 #else
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
184
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
185 /* Define global variable for the C API and a macro for setting it. */
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
186 static PyDateTime_CAPI *PyDateTimeAPI;
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
187
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
188 #define PyDateTime_IMPORT \
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
189 PyDateTimeAPI = (PyDateTime_CAPI*) PyCObject_Import("datetime", \
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
190 "datetime_CAPI")
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
191
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
192 /* This macro would be used if PyCObject_ImportEx() was created.
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
193 #define PyDateTime_IMPORT \
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
194 PyDateTimeAPI = (PyDateTime_CAPI*) PyCObject_ImportEx("datetime", \
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
195 "datetime_CAPI", \
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
196 DATETIME_API_MAGIC)
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
197 */
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
198
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
199 /* Macros for type checking when not building the Python core. */
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
200 #define PyDate_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateType)
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
201 #define PyDate_CheckExact(op) ((op)->ob_type == PyDateTimeAPI->DateType)
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
202
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
203 #define PyDateTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateTimeType)
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
204 #define PyDateTime_CheckExact(op) ((op)->ob_type == PyDateTimeAPI->DateTimeType)
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
205
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
206 #define PyTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TimeType)
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
207 #define PyTime_CheckExact(op) ((op)->ob_type == PyDateTimeAPI->TimeType)
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
208
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
209 #define PyDelta_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DeltaType)
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
210 #define PyDelta_CheckExact(op) ((op)->ob_type == PyDateTimeAPI->DeltaType)
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
211
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
212 #define PyTZInfo_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TZInfoType)
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
213 #define PyTZInfo_CheckExact(op) ((op)->ob_type == PyDateTimeAPI->TZInfoType)
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
214
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
215 /* Macros for accessing constructors in a simplified fashion. */
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
216 #define PyDate_FromDate(year, month, day) \
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
217 PyDateTimeAPI->Date_FromDate(year, month, day, PyDateTimeAPI->DateType)
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
218
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
219 #define PyDateTime_FromDateAndTime(year, month, day, hour, min, sec, usec) \
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
220 PyDateTimeAPI->DateTime_FromDateAndTime(year, month, day, hour, \
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
221 min, sec, usec, Py_None, PyDateTimeAPI->DateTimeType)
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
222
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
223 #define PyTime_FromTime(hour, minute, second, usecond) \
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
224 PyDateTimeAPI->Time_FromTime(hour, minute, second, usecond, \
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
225 Py_None, PyDateTimeAPI->TimeType)
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
226
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
227 #define PyDelta_FromDSU(days, seconds, useconds) \
32428
1c69f909c5a6 Add missing backslash for PyDateTimeAPI->Delta_FromDelta() macro.
Brett Cannon <bcannon@gmail.com>
parents: 32393
diff changeset
228 PyDateTimeAPI->Delta_FromDelta(days, seconds, useconds, 1, \
32393
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
229 PyDateTimeAPI->DeltaType)
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
230
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
231 /* Macros supporting the DB API. */
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
232 #define PyDateTime_FromTimestamp(args) \
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
233 PyDateTimeAPI->DateTime_FromTimestamp( \
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
234 (PyObject*) (PyDateTimeAPI->DateTimeType), args, NULL)
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
235
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
236 #define PyDate_FromTimestamp(args) \
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
237 PyDateTimeAPI->Date_FromTimestamp( \
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
238 (PyObject*) (PyDateTimeAPI->DateType), args)
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
239
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
240 #endif /* Py_BUILD_CORE */
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
241
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
242 #ifdef __cplusplus
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
243 }
26673
5b715cad34d0 datetime escapes the sandbox. The Windows build is all set. I leave it
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
244 #endif
32393
e5df8c8faa09 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
Tim Peters <tim.peters@gmail.com>
parents: 27218
diff changeset
245 #endif