@@ -8,11 +8,54 @@ DateTime Objects
8
8
Various date and time objects are supplied by the :mod: `datetime ` module.
9
9
Before using any of these functions, the header file :file: `datetime.h ` must be
10
10
included in your source (note that this is not included by :file: `Python.h `),
11
- and the macro :c:macro: `PyDateTime_IMPORT ` must be invoked, usually as part of
11
+ and the macro :c:macro: `! PyDateTime_IMPORT ` must be invoked, usually as part of
12
12
the module initialisation function. The macro puts a pointer to a C structure
13
- into a static variable, :c:data: `PyDateTimeAPI `, that is used by the following
13
+ into a static variable, :c:data: `! PyDateTimeAPI `, that is used by the following
14
14
macros.
15
15
16
+ .. c :type :: PyDateTime_Date
17
+
18
+ This subtype of :c:type: `PyObject ` represents a Python date object.
19
+
20
+ .. c :type :: PyDateTime_DateTime
21
+
22
+ This subtype of :c:type: `PyObject ` represents a Python datetime object.
23
+
24
+ .. c :type :: PyDateTime_Time
25
+
26
+ This subtype of :c:type: `PyObject ` represents a Python time object.
27
+
28
+ .. c :type :: PyDateTime_Delta
29
+
30
+ This subtype of :c:type: `PyObject ` represents the difference between two datetime values.
31
+
32
+ .. c :var :: PyTypeObject PyDateTime_DateType
33
+
34
+ This instance of :c:type: `PyTypeObject ` represents the Python date type;
35
+ it is the same object as :class: `datetime.date ` in the Python layer.
36
+
37
+ .. c :var :: PyTypeObject PyDateTime_DateTimeType
38
+
39
+ This instance of :c:type: `PyTypeObject ` represents the Python datetime type;
40
+ it is the same object as :class: `datetime.datetime ` in the Python layer.
41
+
42
+ .. c :var :: PyTypeObject PyDateTime_TimeType
43
+
44
+ This instance of :c:type: `PyTypeObject ` represents the Python time type;
45
+ it is the same object as :class: `datetime.time ` in the Python layer.
46
+
47
+ .. c :var :: PyTypeObject PyDateTime_DeltaType
48
+
49
+ This instance of :c:type: `PyTypeObject ` represents Python type for
50
+ the difference between two datetime values;
51
+ it is the same object as :class: `datetime.timedelta ` in the Python layer.
52
+
53
+ .. c :var :: PyTypeObject PyDateTime_TZInfoType
54
+
55
+ This instance of :c:type: `PyTypeObject ` represents the Python time zone info type;
56
+ it is the same object as :class: `datetime.tzinfo ` in the Python layer.
57
+
58
+
16
59
Macro for access to the UTC singleton:
17
60
18
61
.. c :var :: PyObject* PyDateTime_TimeZone_UTC
@@ -28,7 +71,7 @@ Type-check macros:
28
71
.. c :function :: int PyDate_Check (PyObject *ob)
29
72
30
73
Return true if *ob * is of type :c:data: `PyDateTime_DateType ` or a subtype of
31
- :c:data: `PyDateTime_DateType `. *ob * must not be ``NULL ``. This function always
74
+ :c:data: `! PyDateTime_DateType `. *ob * must not be ``NULL ``. This function always
32
75
succeeds.
33
76
34
77
@@ -41,7 +84,7 @@ Type-check macros:
41
84
.. c :function :: int PyDateTime_Check (PyObject *ob)
42
85
43
86
Return true if *ob * is of type :c:data: `PyDateTime_DateTimeType ` or a subtype of
44
- :c:data: `PyDateTime_DateTimeType `. *ob * must not be ``NULL ``. This function always
87
+ :c:data: `! PyDateTime_DateTimeType `. *ob * must not be ``NULL ``. This function always
45
88
succeeds.
46
89
47
90
@@ -54,7 +97,7 @@ Type-check macros:
54
97
.. c :function :: int PyTime_Check (PyObject *ob)
55
98
56
99
Return true if *ob * is of type :c:data: `PyDateTime_TimeType ` or a subtype of
57
- :c:data: `PyDateTime_TimeType `. *ob * must not be ``NULL ``. This function always
100
+ :c:data: `! PyDateTime_TimeType `. *ob * must not be ``NULL ``. This function always
58
101
succeeds.
59
102
60
103
@@ -67,7 +110,7 @@ Type-check macros:
67
110
.. c :function :: int PyDelta_Check (PyObject *ob)
68
111
69
112
Return true if *ob * is of type :c:data: `PyDateTime_DeltaType ` or a subtype of
70
- :c:data: `PyDateTime_DeltaType `. *ob * must not be ``NULL ``. This function always
113
+ :c:data: `! PyDateTime_DeltaType `. *ob * must not be ``NULL ``. This function always
71
114
succeeds.
72
115
73
116
@@ -80,7 +123,7 @@ Type-check macros:
80
123
.. c :function :: int PyTZInfo_Check (PyObject *ob)
81
124
82
125
Return true if *ob * is of type :c:data: `PyDateTime_TZInfoType ` or a subtype of
83
- :c:data: `PyDateTime_TZInfoType `. *ob * must not be ``NULL ``. This function always
126
+ :c:data: `! PyDateTime_TZInfoType `. *ob * must not be ``NULL ``. This function always
84
127
succeeds.
85
128
86
129
@@ -133,15 +176,15 @@ Macros to create objects:
133
176
:class:`datetime.timedelta` objects.
134
177
135
178
136
- .. c:function:: PyObject* PyTimeZone_FromOffset(PyDateTime_DeltaType* offset)
179
+ .. c:function:: PyObject* PyTimeZone_FromOffset(PyObject * offset)
137
180
138
181
Return a :class: `datetime.timezone ` object with an unnamed fixed offset
139
182
represented by the *offset * argument.
140
183
141
184
.. versionadded :: 3.7
142
185
143
186
144
- .. c:function:: PyObject* PyTimeZone_FromOffsetAndName(PyDateTime_DeltaType* offset, PyUnicode* name)
187
+ .. c :function :: PyObject* PyTimeZone_FromOffsetAndName (PyObject * offset, PyObject * name)
145
188
146
189
Return a :class: `datetime.timezone ` object with a fixed offset represented
147
190
by the *offset * argument and with tzname *name *.
@@ -150,8 +193,8 @@ Macros to create objects:
150
193
151
194
152
195
Macros to extract fields from date objects. The argument must be an instance of
153
- :c:data :`PyDateTime_Date`, including subclasses (such as
154
- :c:data : `PyDateTime_DateTime `). The argument must not be ``NULL``, and the type is
196
+ :c:type : `PyDateTime_Date `, including subclasses (such as
197
+ :c:type : `PyDateTime_DateTime `). The argument must not be ``NULL``, and the type is
155
198
not checked:
156
199
157
200
.. c:function:: int PyDateTime_GET_YEAR(PyDateTime_Date *o)
@@ -170,7 +213,7 @@ not checked:
170
213
171
214
172
215
Macros to extract fields from datetime objects. The argument must be an
173
- instance of :c:data : `PyDateTime_DateTime `, including subclasses. The argument
216
+ instance of :c:type : `PyDateTime_DateTime `, including subclasses. The argument
174
217
must not be ``NULL ``, and the type is not checked:
175
218
176
219
.. c :function :: int PyDateTime_DATE_GET_HOUR (PyDateTime_DateTime *o)
@@ -208,7 +251,7 @@ must not be ``NULL``, and the type is not checked:
208
251
209
252
210
253
Macros to extract fields from time objects. The argument must be an instance of
211
- :c:data :`PyDateTime_Time`, including subclasses. The argument must not be ``NULL``,
254
+ :c:type :`PyDateTime_Time`, including subclasses. The argument must not be ``NULL``,
212
255
and the type is not checked:
213
256
214
257
.. c:function:: int PyDateTime_TIME_GET_HOUR(PyDateTime_Time *o)
@@ -246,7 +289,7 @@ and the type is not checked:
246
289
247
290
248
291
Macros to extract fields from time delta objects. The argument must be an
249
- instance of :c:data :`PyDateTime_Delta`, including subclasses. The argument must
292
+ instance of :c:type :`PyDateTime_Delta`, including subclasses. The argument must
250
293
not be ``NULL``, and the type is not checked:
251
294
252
295
.. c:function:: int PyDateTime_DELTA_GET_DAYS(PyDateTime_Delta *o)
0 commit comments