Changeset 391 for python/trunk/Doc/c-api/datetime.rst
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Doc/c-api/datetime.rst
r2 r391 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 :cfunc:`PyDateTime_IMPORT` must be invoked. The macro puts a 12 pointer to a C structure into a static variable, ``PyDateTimeAPI``, that is 13 used by the following macros. 11 and the macro :c:macro:`PyDateTime_IMPORT` must be invoked, usually as part of 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 14 macros. 14 15 15 16 Type-check macros: 16 17 17 18 18 .. c function:: int PyDate_Check(PyObject *ob)19 20 Return true if *ob* is of type :c data:`PyDateTime_DateType` or a subtype of21 :c data:`PyDateTime_DateType`. *ob* must not be *NULL*.22 23 .. versionadded:: 2.4 24 25 26 .. c function:: int PyDate_CheckExact(PyObject *ob)27 28 Return true if *ob* is of type :c data:`PyDateTime_DateType`. *ob* must not be29 *NULL*. 30 31 .. versionadded:: 2.4 32 33 34 .. c function:: int PyDateTime_Check(PyObject *ob)35 36 Return true if *ob* is of type :c data:`PyDateTime_DateTimeType` or a subtype of37 :c data:`PyDateTime_DateTimeType`. *ob* must not be *NULL*.38 39 .. versionadded:: 2.4 40 41 42 .. c function:: int PyDateTime_CheckExact(PyObject *ob)43 44 Return true if *ob* is of type :c data:`PyDateTime_DateTimeType`. *ob* must not19 .. c:function:: int PyDate_Check(PyObject *ob) 20 21 Return true if *ob* is of type :c:data:`PyDateTime_DateType` or a subtype of 22 :c:data:`PyDateTime_DateType`. *ob* must not be *NULL*. 23 24 .. versionadded:: 2.4 25 26 27 .. c:function:: int PyDate_CheckExact(PyObject *ob) 28 29 Return true if *ob* is of type :c:data:`PyDateTime_DateType`. *ob* must not be 30 *NULL*. 31 32 .. versionadded:: 2.4 33 34 35 .. c:function:: int PyDateTime_Check(PyObject *ob) 36 37 Return true if *ob* is of type :c:data:`PyDateTime_DateTimeType` or a subtype of 38 :c:data:`PyDateTime_DateTimeType`. *ob* must not be *NULL*. 39 40 .. versionadded:: 2.4 41 42 43 .. c:function:: int PyDateTime_CheckExact(PyObject *ob) 44 45 Return true if *ob* is of type :c:data:`PyDateTime_DateTimeType`. *ob* must not 45 46 be *NULL*. 46 47 … … 48 49 49 50 50 .. c function:: int PyTime_Check(PyObject *ob)51 52 Return true if *ob* is of type :c data:`PyDateTime_TimeType` or a subtype of53 :c data:`PyDateTime_TimeType`. *ob* must not be *NULL*.54 55 .. versionadded:: 2.4 56 57 58 .. c function:: int PyTime_CheckExact(PyObject *ob)59 60 Return true if *ob* is of type :c data:`PyDateTime_TimeType`. *ob* must not be61 *NULL*. 62 63 .. versionadded:: 2.4 64 65 66 .. c function:: int PyDelta_Check(PyObject *ob)67 68 Return true if *ob* is of type :c data:`PyDateTime_DeltaType` or a subtype of69 :c data:`PyDateTime_DeltaType`. *ob* must not be *NULL*.70 71 .. versionadded:: 2.4 72 73 74 .. c function:: int PyDelta_CheckExact(PyObject *ob)75 76 Return true if *ob* is of type :c data:`PyDateTime_DeltaType`. *ob* must not be77 *NULL*. 78 79 .. versionadded:: 2.4 80 81 82 .. c function:: int PyTZInfo_Check(PyObject *ob)83 84 Return true if *ob* is of type :c data:`PyDateTime_TZInfoType` or a subtype of85 :c data:`PyDateTime_TZInfoType`. *ob* must not be *NULL*.86 87 .. versionadded:: 2.4 88 89 90 .. c function:: int PyTZInfo_CheckExact(PyObject *ob)91 92 Return true if *ob* is of type :c data:`PyDateTime_TZInfoType`. *ob* must not be51 .. c:function:: int PyTime_Check(PyObject *ob) 52 53 Return true if *ob* is of type :c:data:`PyDateTime_TimeType` or a subtype of 54 :c:data:`PyDateTime_TimeType`. *ob* must not be *NULL*. 55 56 .. versionadded:: 2.4 57 58 59 .. c:function:: int PyTime_CheckExact(PyObject *ob) 60 61 Return true if *ob* is of type :c:data:`PyDateTime_TimeType`. *ob* must not be 62 *NULL*. 63 64 .. versionadded:: 2.4 65 66 67 .. c:function:: int PyDelta_Check(PyObject *ob) 68 69 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*. 71 72 .. versionadded:: 2.4 73 74 75 .. c:function:: int PyDelta_CheckExact(PyObject *ob) 76 77 Return true if *ob* is of type :c:data:`PyDateTime_DeltaType`. *ob* must not be 78 *NULL*. 79 80 .. versionadded:: 2.4 81 82 83 .. c:function:: int PyTZInfo_Check(PyObject *ob) 84 85 Return true if *ob* is of type :c:data:`PyDateTime_TZInfoType` or a subtype of 86 :c:data:`PyDateTime_TZInfoType`. *ob* must not be *NULL*. 87 88 .. versionadded:: 2.4 89 90 91 .. c:function:: int PyTZInfo_CheckExact(PyObject *ob) 92 93 Return true if *ob* is of type :c:data:`PyDateTime_TZInfoType`. *ob* must not be 93 94 *NULL*. 94 95 … … 98 99 99 100 100 .. c function:: PyObject* PyDate_FromDate(int year, int month, int day)101 .. c:function:: PyObject* PyDate_FromDate(int year, int month, int day) 101 102 102 103 Return a ``datetime.date`` object with the specified year, month and day. … … 105 106 106 107 107 .. c function:: PyObject* PyDateTime_FromDateAndTime(int year, int month, int day, int hour, int minute, int second, int usecond)108 .. c:function:: PyObject* PyDateTime_FromDateAndTime(int year, int month, int day, int hour, int minute, int second, int usecond) 108 109 109 110 Return a ``datetime.datetime`` object with the specified year, month, day, hour, … … 113 114 114 115 115 .. c function:: PyObject* PyTime_FromTime(int hour, int minute, int second, int usecond)116 .. c:function:: PyObject* PyTime_FromTime(int hour, int minute, int second, int usecond) 116 117 117 118 Return a ``datetime.time`` object with the specified hour, minute, second and … … 121 122 122 123 123 .. c function:: PyObject* PyDelta_FromDSU(int days, int seconds, int useconds)124 .. c:function:: PyObject* PyDelta_FromDSU(int days, int seconds, int useconds) 124 125 125 126 Return a ``datetime.timedelta`` object representing the given number of days, … … 131 132 132 133 Macros to extract fields from date objects. The argument must be an instance of 133 :c data:`PyDateTime_Date`, including subclasses (such as134 :c data:`PyDateTime_DateTime`). The argument must not be *NULL*, and the type is134 :c:data:`PyDateTime_Date`, including subclasses (such as 135 :c:data:`PyDateTime_DateTime`). The argument must not be *NULL*, and the type is 135 136 not checked: 136 137 137 138 138 .. c function:: int PyDateTime_GET_YEAR(PyDateTime_Date *o)139 .. c:function:: int PyDateTime_GET_YEAR(PyDateTime_Date *o) 139 140 140 141 Return the year, as a positive int. … … 143 144 144 145 145 .. c function:: int PyDateTime_GET_MONTH(PyDateTime_Date *o)146 .. c:function:: int PyDateTime_GET_MONTH(PyDateTime_Date *o) 146 147 147 148 Return the month, as an int from 1 through 12. … … 150 151 151 152 152 .. c function:: int PyDateTime_GET_DAY(PyDateTime_Date *o)153 .. c:function:: int PyDateTime_GET_DAY(PyDateTime_Date *o) 153 154 154 155 Return the day, as an int from 1 through 31. … … 157 158 158 159 Macros to extract fields from datetime objects. The argument must be an 159 instance of :c data:`PyDateTime_DateTime`, including subclasses. The argument160 instance of :c:data:`PyDateTime_DateTime`, including subclasses. The argument 160 161 must not be *NULL*, and the type is not checked: 161 162 162 163 163 .. c function:: int PyDateTime_DATE_GET_HOUR(PyDateTime_DateTime *o)164 .. c:function:: int PyDateTime_DATE_GET_HOUR(PyDateTime_DateTime *o) 164 165 165 166 Return the hour, as an int from 0 through 23. … … 168 169 169 170 170 .. c function:: int PyDateTime_DATE_GET_MINUTE(PyDateTime_DateTime *o)171 .. c:function:: int PyDateTime_DATE_GET_MINUTE(PyDateTime_DateTime *o) 171 172 172 173 Return the minute, as an int from 0 through 59. … … 175 176 176 177 177 .. c function:: int PyDateTime_DATE_GET_SECOND(PyDateTime_DateTime *o)178 .. c:function:: int PyDateTime_DATE_GET_SECOND(PyDateTime_DateTime *o) 178 179 179 180 Return the second, as an int from 0 through 59. … … 182 183 183 184 184 .. c function:: int PyDateTime_DATE_GET_MICROSECOND(PyDateTime_DateTime *o)185 .. c:function:: int PyDateTime_DATE_GET_MICROSECOND(PyDateTime_DateTime *o) 185 186 186 187 Return the microsecond, as an int from 0 through 999999. … … 189 190 190 191 Macros to extract fields from time objects. The argument must be an instance of 191 :c data:`PyDateTime_Time`, including subclasses. The argument must not be *NULL*,192 :c:data:`PyDateTime_Time`, including subclasses. The argument must not be *NULL*, 192 193 and the type is not checked: 193 194 194 195 195 .. c function:: int PyDateTime_TIME_GET_HOUR(PyDateTime_Time *o)196 .. c:function:: int PyDateTime_TIME_GET_HOUR(PyDateTime_Time *o) 196 197 197 198 Return the hour, as an int from 0 through 23. … … 200 201 201 202 202 .. c function:: int PyDateTime_TIME_GET_MINUTE(PyDateTime_Time *o)203 .. c:function:: int PyDateTime_TIME_GET_MINUTE(PyDateTime_Time *o) 203 204 204 205 Return the minute, as an int from 0 through 59. … … 207 208 208 209 209 .. c function:: int PyDateTime_TIME_GET_SECOND(PyDateTime_Time *o)210 .. c:function:: int PyDateTime_TIME_GET_SECOND(PyDateTime_Time *o) 210 211 211 212 Return the second, as an int from 0 through 59. … … 214 215 215 216 216 .. c function:: int PyDateTime_TIME_GET_MICROSECOND(PyDateTime_Time *o)217 .. c:function:: int PyDateTime_TIME_GET_MICROSECOND(PyDateTime_Time *o) 217 218 218 219 Return the microsecond, as an int from 0 through 999999. … … 223 224 224 225 225 .. c function:: PyObject* PyDateTime_FromTimestamp(PyObject *args)226 .. c:function:: PyObject* PyDateTime_FromTimestamp(PyObject *args) 226 227 227 228 Create and return a new ``datetime.datetime`` object given an argument tuple … … 231 232 232 233 233 .. c function:: PyObject* PyDate_FromTimestamp(PyObject *args)234 .. c:function:: PyObject* PyDate_FromTimestamp(PyObject *args) 234 235 235 236 Create and return a new ``datetime.date`` object given an argument tuple
Note:
See TracChangeset
for help on using the changeset viewer.