DateTime 객체
*************

Various date and time objects are supplied by the "datetime" module.
Before using any of these functions, the header file "datetime.h" must
be included in your source (note that this is not included by
"Python.h"), and the macro "PyDateTime_IMPORT" must be invoked,
usually as part of the module initialisation function.  The macro puts
a pointer to a C structure into a static variable, "PyDateTimeAPI",
that is used by the following macros.

PyDateTime_IMPORT()

   Import the datetime C API.

   On success, populate the "PyDateTimeAPI" pointer. On failure, set
   "PyDateTimeAPI" to "NULL" and set an exception. The caller must
   check if an error occurred via "PyErr_Occurred()":

      PyDateTime_IMPORT;
      if (PyErr_Occurred()) { /* cleanup */ }

   경고:

     This is not compatible with subinterpreters.

type PyDateTime_CAPI

   Structure containing the fields for the datetime C API.

   The fields of this structure are private and subject to change.

   Do not use this directly; prefer "PyDateTime_*" APIs instead.

PyDateTime_CAPI *PyDateTimeAPI

   Dynamically allocated object containing the datetime C API.

   This variable is only available once "PyDateTime_IMPORT" succeeds.

type PyDateTime_Date

   This subtype of "PyObject" represents a Python date object.

type PyDateTime_DateTime

   This subtype of "PyObject" represents a Python datetime object.

type PyDateTime_Time

   This subtype of "PyObject" represents a Python time object.

type PyDateTime_Delta

   This subtype of "PyObject" represents the difference between two
   datetime values.

PyTypeObject PyDateTime_DateType

   This instance of "PyTypeObject" represents the Python date type; it
   is the same object as "datetime.date" in the Python layer.

PyTypeObject PyDateTime_DateTimeType

   This instance of "PyTypeObject" represents the Python datetime
   type; it is the same object as "datetime.datetime" in the Python
   layer.

PyTypeObject PyDateTime_TimeType

   This instance of "PyTypeObject" represents the Python time type; it
   is the same object as "datetime.time" in the Python layer.

PyTypeObject PyDateTime_DeltaType

   This instance of "PyTypeObject" represents the Python type for the
   difference between two datetime values; it is the same object as
   "datetime.timedelta" in the Python layer.

PyTypeObject PyDateTime_TZInfoType

   This instance of "PyTypeObject" represents the Python time zone
   info type; it is the same object as "datetime.tzinfo" in the Python
   layer.

UTC 싱글톤에 액세스하기 위한 매크로:

PyObject *PyDateTime_TimeZone_UTC

   UTC를 나타내는 시간대 싱글톤을 반환합니다, "datetime.timezone.utc"
   와 같은 객체입니다.

   Added in version 3.7.

형 검사 매크로:

int PyDate_Check(PyObject *ob)

   *ob*가 "PyDateTime_DateType" 형이거나 "PyDateTime_DateType"의 서브
   형이면 참을 돌려줍니다. *ob*는 "NULL"이 아니어야 합니다. 이 함수는
   항상 성공합니다.

int PyDate_CheckExact(PyObject *ob)

   *ob*가 "PyDateTime_DateType" 형이면 참을 돌려줍니다. *ob*는 "NULL"
   이 아니어야 합니다. 이 함수는 항상 성공합니다.

int PyDateTime_Check(PyObject *ob)

   *ob*가 "PyDateTime_DateTimeType" 형이거나 "PyDateTime_DateTimeType"
   의 서브 형이면 참을 돌려줍니다. *ob*는 "NULL"이 아니어야 합니다. 이
   함수는 항상 성공합니다.

int PyDateTime_CheckExact(PyObject *ob)

   *ob*가 "PyDateTime_DateTimeType" 형이면 참을 돌려줍니다. *ob*는
   "NULL"이 아니어야 합니다. 이 함수는 항상 성공합니다.

int PyTime_Check(PyObject *ob)

   *ob*가 "PyDateTime_TimeType" 형이거나 "PyDateTime_TimeType"의 서브
   형이면 참을 돌려줍니다. *ob*는 "NULL"이 아니어야 합니다. 이 함수는
   항상 성공합니다.

int PyTime_CheckExact(PyObject *ob)

   *ob*가 "PyDateTime_TimeType" 형이면 참을 돌려줍니다. *ob*는 "NULL"
   이 아니어야 합니다. 이 함수는 항상 성공합니다.

int PyDelta_Check(PyObject *ob)

   *ob*가 "PyDateTime_DeltaType" 형이거나 "PyDateTime_DeltaType"의 서
   브 형이면 참을 돌려줍니다. *ob*는 "NULL"이 아니어야 합니다. 이 함수
   는 항상 성공합니다.

int PyDelta_CheckExact(PyObject *ob)

   *ob*가 "PyDateTime_DeltaType" 형이면 참을 돌려줍니다. *ob*는 "NULL"
   이 아니어야 합니다. 이 함수는 항상 성공합니다.

int PyTZInfo_Check(PyObject *ob)

   *ob*가 "PyDateTime_TZInfoType" 형이거나 "PyDateTime_TZInfoType"의
   서브 형이면 참을 돌려줍니다. *ob*는 "NULL"이 아니어야 합니다. 이 함
   수는 항상 성공합니다.

int PyTZInfo_CheckExact(PyObject *ob)

   *ob*가 "PyDateTime_TZInfoType" 형이면 참을 돌려줍니다. *ob*는
   "NULL"이 아니어야 합니다. 이 함수는 항상 성공합니다.

객체를 만드는 매크로:

PyObject *PyDate_FromDate(int year, int month, int day)
    *반환값: 새 참조.*

   지정된 년, 월, 일의 "datetime.date" 객체를 반환합니다.

PyObject *PyDateTime_FromDateAndTime(int year, int month, int day, int hour, int minute, int second, int usecond)
    *반환값: 새 참조.*

   지정된 년, 월, 일, 시, 분, 초 및 마이크로초의 "datetime.datetime"
   객체를 반환합니다.

PyObject *PyDateTime_FromDateAndTimeAndFold(int year, int month, int day, int hour, int minute, int second, int usecond, int fold)
    *반환값: 새 참조.*

   지정된 년, 월, 일, 시, 분, 초, 마이크로초 및 fold의
   "datetime.datetime" 객체를 반환합니다.

   Added in version 3.6.

PyObject *PyTime_FromTime(int hour, int minute, int second, int usecond)
    *반환값: 새 참조.*

   지정된 시, 분, 초 및 마이크로초의 "datetime.time" 객체를 반환합니다
   .

PyObject *PyTime_FromTimeAndFold(int hour, int minute, int second, int usecond, int fold)
    *반환값: 새 참조.*

   지정된 시, 분, 초, 마이크로초 및 fold의 "datetime.time" 객체를 반환
   합니다.

   Added in version 3.6.

PyObject *PyDelta_FromDSU(int days, int seconds, int useconds)
    *반환값: 새 참조.*

   지정된 일, 초 및 마이크로초 수를 나타내는 "datetime.timedelta" 객체
   를 반환합니다. 결과 마이크로초와 초가 "datetime.timedelta" 객체에
   관해 설명된 범위에 있도록 정규화가 수행됩니다.

PyObject *PyTimeZone_FromOffset(PyObject *offset)
    *반환값: 새 참조.*

   *offset* 인자로 나타내지는 이름이 없는 고정 오프셋의
   "datetime.timezone" 객체를 돌려줍니다.

   Added in version 3.7.

PyObject *PyTimeZone_FromOffsetAndName(PyObject *offset, PyObject *name)
    *반환값: 새 참조.*

   *offset* 인자와 tzname *name*으로 나타내지는 고정 오프셋의
   "datetime.timezone" 객체를 돌려줍니다.

   Added in version 3.7.

날짜 객체에서 필드를 추출하는 매크로. 인자는 서브 클래스(가령
"PyDateTime_DateTime")를 포함하여 "PyDateTime_Date"의 인스턴스여야 합
니다. 인자는 "NULL"이 아니어야 하며, 형은 검사하지 않습니다:

int PyDateTime_GET_YEAR(PyDateTime_Date *o)

   양의 int로, 년을 반환합니다.

int PyDateTime_GET_MONTH(PyDateTime_Date *o)

   1에서 12까지의 int로, 월을 반환합니다.

int PyDateTime_GET_DAY(PyDateTime_Date *o)

   1에서 31까지의 int로, 일을 반환합니다.

날짜 시간 객체에서 필드를 추출하는 매크로. 인자는 서브 클래스를 포함하
여 "PyDateTime_DateTime"의 인스턴스여야 합니다. 인자는 "NULL"이 아니어
야 하며, 형은 검사하지 않습니다.:

int PyDateTime_DATE_GET_HOUR(PyDateTime_DateTime *o)

   0부터 23까지의 int로, 시를 반환합니다.

int PyDateTime_DATE_GET_MINUTE(PyDateTime_DateTime *o)

   0부터 59까지의 int로, 분을 반환합니다.

int PyDateTime_DATE_GET_SECOND(PyDateTime_DateTime *o)

   0부터 59까지의 int로, 초를 반환합니다.

int PyDateTime_DATE_GET_MICROSECOND(PyDateTime_DateTime *o)

   0부터 999999까지의 int로, 마이크로초를 반환합니다.

int PyDateTime_DATE_GET_FOLD(PyDateTime_DateTime *o)

   0에서 1까지의 int로, 폴드를 반환합니다.

   Added in version 3.6.

PyObject *PyDateTime_DATE_GET_TZINFO(PyDateTime_DateTime *o)

   Return the tzinfo (which may be "None").

   Added in version 3.10.

시간 객체에서 필드를 추출하는 매크로. 인자는 서브 클래스를 포함하여
"PyDateTime_Time"의 인스턴스여야 합니다. 인자는 "NULL"이 아니어야 하며
형은 검사하지 않습니다:

int PyDateTime_TIME_GET_HOUR(PyDateTime_Time *o)

   0부터 23까지의 int로, 시를 반환합니다.

int PyDateTime_TIME_GET_MINUTE(PyDateTime_Time *o)

   0부터 59까지의 int로, 분을 반환합니다.

int PyDateTime_TIME_GET_SECOND(PyDateTime_Time *o)

   0부터 59까지의 int로, 초를 반환합니다.

int PyDateTime_TIME_GET_MICROSECOND(PyDateTime_Time *o)

   0부터 999999까지의 int로, 마이크로초를 반환합니다.

int PyDateTime_TIME_GET_FOLD(PyDateTime_Time *o)

   0에서 1까지의 int로, 폴드를 반환합니다.

   Added in version 3.6.

PyObject *PyDateTime_TIME_GET_TZINFO(PyDateTime_Time *o)

   Return the tzinfo (which may be "None").

   Added in version 3.10.

시간 델타 객체에서 필드를 추출하는 매크로. 인자는 서브 클래스를 포함하
여 "PyDateTime_Delta"의 인스턴스여야 합니다. 인자는 "NULL"이 아니어야
하며 형은 검사하지 않습니다.:

int PyDateTime_DELTA_GET_DAYS(PyDateTime_Delta *o)

   -999999999에서 999999999까지의 int로, 일 수를 반환합니다.

   Added in version 3.3.

int PyDateTime_DELTA_GET_SECONDS(PyDateTime_Delta *o)

   0부터 86399까지의 int로, 초 수를 반환합니다.

   Added in version 3.3.

int PyDateTime_DELTA_GET_MICROSECONDS(PyDateTime_Delta *o)

   0에서 999999까지의 int로, 마이크로초 수를 반환합니다.

   Added in version 3.3.

DB API를 구현하는 모듈의 편의를 위한 매크로:

PyObject *PyDateTime_FromTimestamp(PyObject *args)
    *반환값: 새 참조.*

   "datetime.datetime.fromtimestamp()"에 전달하는 데 적합한 인자 튜플
   로 새 "datetime.datetime" 객체를 만들고 반환합니다.

PyObject *PyDate_FromTimestamp(PyObject *args)
    *반환값: 새 참조.*

   "datetime.date.fromtimestamp()"에 전달하는 데 적합한 인자 튜플로 새
   "datetime.date" 객체를 만들고 반환합니다.


Internal data
*************

The following symbols are exposed by the C API but should be
considered internal-only.

PyDateTime_CAPSULE_NAME

   Name of the datetime capsule to pass to "PyCapsule_Import()".

   Internal usage only. Use "PyDateTime_IMPORT" instead.
