@@ -2656,73 +2656,77 @@ \subsection{DateTime Objects \label{datetime-objects}}
26562656not include by \file {Python.h}), and macro \cfunction {PyDateTime_IMPORT()}
26572657must be invoked. The macro arranges to put a pointer to a C structure
26582658in a static variable \code {PyDateTimeAPI}, which is used by the following
2659- macros:
2659+ macros.
26602660
2661- \begin {cfuncdesc }{int}{PyDate_Check}{ob}
2661+ Type-check macros:
2662+
2663+ \begin {cfuncdesc }{int}{PyDate_Check}{PyObject *ob}
26622664 Return true if \var {ob} is of type \cdata {PyDateTime_DateType} or
26632665 a subtype of \cdata {PyDateTime_DateType}. \var {ob} must not be
26642666 \NULL {}.
26652667 \versionadded {2.4}
26662668\end {cfuncdesc }
26672669
2668- \begin {cfuncdesc }{int}{PyDate_CheckExact}{ob}
2670+ \begin {cfuncdesc }{int}{PyDate_CheckExact}{PyObject * ob}
26692671 Return true if \var {ob} is of type \cdata {PyDateTime_DateType}.
26702672 \var {ob} must not be \NULL {}.
26712673 \versionadded {2.4}
26722674\end {cfuncdesc }
26732675
2674- \begin {cfuncdesc }{int}{PyDateTime_Check}{ob}
2676+ \begin {cfuncdesc }{int}{PyDateTime_Check}{PyObject * ob}
26752677 Return true if \var {ob} is of type \cdata {PyDateTime_DateTimeType} or
26762678 a subtype of \cdata {PyDateTime_DateTimeType}. \var {ob} must not be
26772679 \NULL {}.
26782680 \versionadded {2.4}
26792681\end {cfuncdesc }
26802682
2681- \begin {cfuncdesc }{int}{PyDateTime_CheckExact}{ob}
2683+ \begin {cfuncdesc }{int}{PyDateTime_CheckExact}{PyObject * ob}
26822684 Return true if \var {ob} is of type \cdata {PyDateTime_DateTimeType}.
26832685 \var {ob} must not be \NULL {}.
26842686 \versionadded {2.4}
26852687\end {cfuncdesc }
26862688
2687- \begin {cfuncdesc }{int}{PyTime_Check}{ob}
2689+ \begin {cfuncdesc }{int}{PyTime_Check}{PyObject * ob}
26882690 Return true if \var {ob} is of type \cdata {PyDateTime_TimeType} or
26892691 a subtype of \cdata {PyDateTime_TimeType}. \var {ob} must not be
26902692 \NULL {}.
26912693 \versionadded {2.4}
26922694\end {cfuncdesc }
26932695
2694- \begin {cfuncdesc }{int}{PyTime_CheckExact}{ob}
2696+ \begin {cfuncdesc }{int}{PyTime_CheckExact}{PyObject * ob}
26952697 Return true if \var {ob} is of type \cdata {PyDateTime_TimeType}.
26962698 \var {ob} must not be \NULL {}.
26972699 \versionadded {2.4}
26982700\end {cfuncdesc }
26992701
2700- \begin {cfuncdesc }{int}{PyDelta_Check}{ob}
2702+ \begin {cfuncdesc }{int}{PyDelta_Check}{PyObject * ob}
27012703 Return true if \var {ob} is of type \cdata {PyDateTime_DeltaType} or
27022704 a subtype of \cdata {PyDateTime_DeltaType}. \var {ob} must not be
27032705 \NULL {}.
27042706 \versionadded {2.4}
27052707\end {cfuncdesc }
27062708
2707- \begin {cfuncdesc }{int}{PyDelta_CheckExact}{ob}
2709+ \begin {cfuncdesc }{int}{PyDelta_CheckExact}{PyObject * ob}
27082710 Return true if \var {ob} is of type \cdata {PyDateTime_DeltaType}.
27092711 \var {ob} must not be \NULL {}.
27102712 \versionadded {2.4}
27112713\end {cfuncdesc }
27122714
2713- \begin {cfuncdesc }{int}{PyTZInfo_Check}{ob}
2715+ \begin {cfuncdesc }{int}{PyTZInfo_Check}{PyObject * ob}
27142716 Return true if \var {ob} is of type \cdata {PyDateTime_TZInfoType} or
27152717 a subtype of \cdata {PyDateTime_TZInfoType}. \var {ob} must not be
27162718 \NULL {}.
27172719 \versionadded {2.4}
27182720\end {cfuncdesc }
27192721
2720- \begin {cfuncdesc }{int}{PyTZInfo_CheckExact}{ob}
2722+ \begin {cfuncdesc }{int}{PyTZInfo_CheckExact}{PyObject * ob}
27212723 Return true if \var {ob} is of type \cdata {PyDateTime_TZInfoType}.
27222724 \var {ob} must not be \NULL {}.
27232725 \versionadded {2.4}
27242726\end {cfuncdesc }
27252727
2728+ Macros to create objects:
2729+
27262730\begin {cfuncdesc }{PyObject*}{PyDate_FromDate}{int year, int month, int day}
27272731 Return a \code {datetime.date} object with the specified year, month
27282732 and day.
@@ -2752,18 +2756,84 @@ \subsection{DateTime Objects \label{datetime-objects}}
27522756 \versionadded {2.4}
27532757\end {cfuncdesc }
27542758
2759+ Macros to extract fields from date objects. The argument must an
2760+ instance of \cdata {PyDateTime_Date}, including subclasses (such as
2761+ \cdata {PyDateTime_DateTime}). The argument must not be \NULL {}, and
2762+ the type is not checked:
2763+
2764+ \begin {cfuncdesc }{int}{PyDateTime_GET_YEAR}{PyDateTime_Date *o}
2765+ Return the year, as a positive int.
2766+ \versionadded {2.4}
2767+ \end {cfuncdesc }
2768+
2769+ \begin {cfuncdesc }{int}{PyDateTime_GET_MONTH}{PyDateTime_Date *o}
2770+ Return the month, as an int from 1 through 12.
2771+ \versionadded {2.4}
2772+ \end {cfuncdesc }
2773+
2774+ \begin {cfuncdesc }{int}{PyDateTime_GET_DAY}{PyDateTime_Date *o}
2775+ Return the day, as an int from 1 through 31.
2776+ \versionadded {2.4}
2777+ \end {cfuncdesc }
2778+
2779+ Macros to extract fields from datetime objects. The argument must an
2780+ instance of \cdata {PyDateTime_DateTime}, including subclasses.
2781+ The argument must not be \NULL {}, and the type is not checked:
2782+
2783+ \begin {cfuncdesc }{int}{PyDateTime_DATE_GET_HOUR}{PyDateTime_DateTime *o}
2784+ Return the hour, an an int from 0 though 23.
2785+ \versionadded {2.4}
2786+ \end {cfuncdesc }
2787+
2788+ \begin {cfuncdesc }{int}{PyDateTime_DATE_GET_MINUTE}{PyDateTime_DateTime *o}
2789+ Return the minute, as an int from 0 through 59.
2790+ \versionadded {2.4}
2791+ \end {cfuncdesc }
2792+
2793+ \begin {cfuncdesc }{int}{PyDateTime_DATE_GET_SECOND}{PyDateTime_DateTime *o}
2794+ Return the second, as an int from 0 through 59.
2795+ \versionadded {2.4}
2796+ \end {cfuncdesc }
2797+
2798+ \begin {cfuncdesc }{int}{PyDateTime_DATE_GET_MICROSECOND}{PyDateTime_DateTime *o}
2799+ Return the microsecond, as an int from 0 through 999999.
2800+ \versionadded {2.4}
2801+ \end {cfuncdesc }
2802+
2803+ Macros to extract fields from time objects. The argument must an
2804+ instance of \cdata {PyDateTime_Time}, including subclasses.
2805+ The argument must not be \NULL {}, and the type is not checked:
2806+
2807+ \begin {cfuncdesc }{int}{PyDateTime_TIME_GET_HOUR}{PyDateTime_Time *o}
2808+ Return the hour, as an int from 0 though 23.
2809+ \versionadded {2.4}
2810+ \end {cfuncdesc }
2811+
2812+ \begin {cfuncdesc }{int}{PyDateTime_TIME_GET_MINUTE}{PyDateTime_Time *o}
2813+ Return the minute, as an int from 0 through 59.
2814+ \versionadded {2.4}
2815+ \end {cfuncdesc }
2816+
2817+ \begin {cfuncdesc }{int}{PyDateTime_TIME_GET_SECOND}{PyDateTime_Time *o}
2818+ Return the second, as an int from 0 through 59.
2819+ \versionadded {2.4}
2820+ \end {cfuncdesc }
2821+
2822+ \begin {cfuncdesc }{int}{PyDateTime_TIME_GET_MICROSECOND}{PyDateTime_Time *o}
2823+ Return the microsecond, as an int from 0 through 999999.
2824+ \versionadded {2.4}
2825+ \end {cfuncdesc }
2826+
2827+ Macros for the convenience of modules implementing the DB API:
2828+
27552829\begin {cfuncdesc }{PyObject*}{PyDateTime_FromTimestamp}{PyObject *args}
27562830 Create and return a new \code {datetime.datetime} object given an argument
27572831 tuple suitable for passing to \code {datetime.datetime.fromtimestamp()}.
2758- This macro is included for the convenience of modules implementing the
2759- DB API.
27602832 \versionadded {2.4}
27612833\end {cfuncdesc }
27622834
27632835\begin {cfuncdesc }{PyObject*}{PyDate_FromTimestamp}{PyObject *args}
27642836 Create and return a new \code {datetime.date} object given an argument
27652837 tuple suitable for passing to \code {datetime.date.fromtimestamp()}.
2766- This macro is included for the convenience of modules implementing the
2767- DB API.
27682838 \versionadded {2.4}
27692839\end {cfuncdesc }
0 commit comments